* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Improve text rendering */
html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2.5em;
}

/* Auto-update indicator */
.auto-update-indicator {
    position: absolute;
    top: 35px;
    right: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(102, 126, 234, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #667eea;
    font-weight: 600;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
    will-change: transform, opacity;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

.indicator-text {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.backup-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn-secondary {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    padding: 10px 20px;
    font-size: 14px;
}

.btn-secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.3);
}

.search-section {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#searchInput {
    width: 100%;
    max-width: 600px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    text-align: center;
}

#searchInput:focus {
    outline: none;
    border-color: #667eea;
}

.input-section {
    margin-bottom: 30px;
}

.hide-content-section {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.toggle-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    gap: 12px;
}

.toggle-container input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 26px;
    background-color: #ccc;
    border-radius: 34px;
    transition: background-color 0.3s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-container input[type="checkbox"]:checked+.toggle-slider {
    background-color: #667eea;
}

.toggle-container input[type="checkbox"]:checked+.toggle-slider::before {
    transform: translateX(24px);
}

.toggle-label {
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

#passwordInput {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 15px;
    transition: border-color 0.3s;
}

#passwordInput:focus {
    outline: none;
    border-color: #667eea;
}

#titleInput {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 15px;
    transition: border-color 0.3s;
}

#titleInput:focus {
    outline: none;
    border-color: #667eea;
}

#codeInput {
    width: 100%;
    min-height: 150px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: vertical;
    margin-bottom: 15px;
    transition: border-color 0.3s;
}

#codeInput:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s;
    margin-right: 10px;
}

.btn-add {
    background: #667eea;
    color: white;
    width: 100%;
}

.btn-add:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.code-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.code-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    position: relative;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.code-content {
    background: #333;
    color: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-bottom: 10px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
}

.code-content.protected {
    position: relative;
    background: #1a1a1a;
    color: #888;
    filter: blur(10px);
    user-select: none;
    pointer-events: none;
    min-height: 100px;
}

.code-content-wrapper {
    position: relative;
    margin-bottom: 15px;
}

.eye-unlock-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(102, 126, 234, 0.95);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.eye-unlock-btn:hover {
    background: rgba(102, 126, 234, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.eye-unlock-btn .eye-text {
    font-size: 12px;
}



.code-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.btn-copy {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
}

.btn-copy:hover {
    background: linear-gradient(135deg, #218838 0%, #1aa179 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

.btn-copy.copied {
    background: linear-gradient(135deg, #20c997 0%, #17a2b8 100%);
}

.btn-delete {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
}

.btn-delete:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 18px;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 18px;
}

.highlight {
    background-color: #ffd700;
    font-weight: bold;
    padding: 2px 0;
}

.code-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.timestamp {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 10px;
}

/* Scrollbar styling */
.code-content::-webkit-scrollbar {
    width: 8px;
}

.code-content::-webkit-scrollbar-track {
    background: #1e2127;
    border-radius: 6px;
}

.code-content::-webkit-scrollbar-thumb {
    background: #4b5263;
    border-radius: 6px;
}

.code-content::-webkit-scrollbar-thumb:hover {
    background: #5c6370;
}

/* Responsive Design */

/* Large Laptops & Desktops (1200px and above) */
@media (min-width: 1200px) {
    .container {
        max-width: 900px;
        padding: 40px;
    }

    h1 {
        font-size: 2.8em;
    }

    .code-list {
        gap: 20px;
    }

    .code-item {
        padding: 20px;
    }

    .code-content {
        max-height: 350px;
    }
}

/* Laptops & Small Desktops (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .container {
        max-width: 850px;
        padding: 35px;
    }

    h1 {
        font-size: 2.5em;
    }
}

/* iPad Pro & Large Tablets (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    body {
        padding: 15px;
    }

    .container {
        max-width: 720px;
        padding: 30px;
    }

    h1 {
        font-size: 2.2em;
        margin-bottom: 25px;
    }

    .auto-update-indicator {
        top: 30px;
        right: 30px;
        padding: 5px 10px;
        font-size: 11px;
    }

    .pulse-dot {
        width: 7px;
        height: 7px;
    }

    #searchInput {
        max-width: 100%;
    }

    .content-type-selector {
        gap: 12px;
    }

    .type-option {
        padding: 10px 15px;
    }

    .code-actions {
        flex-direction: row;
    }

    .btn-copy,
    .btn-delete,
    .btn-download {
        min-width: 100px;
        padding: 10px 15px;
        font-size: 14px;
    }
}

/* iPad Mini & Small Tablets (600px - 767px) */
@media (min-width: 600px) and (max-width: 767px) {
    body {
        padding: 12px;
    }

    .container {
        padding: 25px;
        border-radius: 10px;
    }

    h1 {
        font-size: 2em;
        margin-bottom: 20px;
    }

    .auto-update-indicator {
        top: 25px;
        right: 25px;
        padding: 5px 10px;
        font-size: 11px;
    }

    #searchInput,
    #passwordInput,
    #titleInput {
        padding: 12px;
        font-size: 15px;
        margin-bottom: 12px;
    }

    #codeInput {
        min-height: 130px;
        padding: 12px;
        font-size: 14px;
    }

    .content-type-selector {
        gap: 10px;
    }

    .type-option {
        padding: 10px 14px;
    }

    .type-option span {
        font-size: 13px;
    }

    .code-item {
        padding: 15px;
    }

    .code-title {
        font-size: 17px;
    }

    .code-content {
        padding: 12px;
        font-size: 13px;
        max-height: 280px;
    }

    .code-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .btn-copy,
    .btn-delete,
    .btn-download {
        flex: 1;
        min-width: 100px;
    }
}

/* Large Phones (480px - 599px) */
@media (min-width: 480px) and (max-width: 599px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 20px;
        border-radius: 8px;
    }

    h1 {
        font-size: 1.8em;
        margin-bottom: 18px;
    }

    .auto-update-indicator {
        position: relative;
        top: auto;
        right: auto;
        margin: 0 auto 15px;
        width: fit-content;
        padding: 5px 12px;
        font-size: 11px;
    }

    .pulse-dot {
        width: 6px;
        height: 6px;
    }

    #searchInput,
    #passwordInput,
    #titleInput {
        padding: 12px;
        font-size: 14px;
        margin-bottom: 12px;
    }

    #codeInput {
        min-height: 110px;
        padding: 12px;
        font-size: 13px;
        margin-bottom: 12px;
    }

    .content-type-selector {
        gap: 8px;
    }

    .type-option {
        flex: 1;
        justify-content: center;
        padding: 10px 12px;
    }

    .type-option span {
        font-size: 12px;
    }

    .btn {
        padding: 11px 18px;
        font-size: 14px;
    }

    .code-item {
        padding: 12px;
    }

    .code-title {
        font-size: 16px;
        margin-bottom: 6px;
    }

    .code-content {
        padding: 12px;
        font-size: 13px;
        max-height: 250px;
    }

    .code-actions {
        flex-direction: column;
        gap: 8px;
    }

    .btn-copy,
    .btn-delete,
    .btn-download {
        width: 100%;
        margin-right: 0;
    }

    .snippet-header {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }
}

/* Small Phones (320px - 479px) */
@media (max-width: 479px) {
    body {
        padding: 8px;
    }

    .container {
        padding: 15px;
        border-radius: 8px;
    }

    h1 {
        font-size: 1.5em;
        margin-bottom: 15px;
        padding-right: 0;
    }

    .auto-update-indicator {
        position: relative;
        top: auto;
        right: auto;
        margin: 0 auto 12px;
        width: fit-content;
        padding: 4px 10px;
        font-size: 10px;
        gap: 6px;
    }

    .pulse-dot {
        width: 6px;
        height: 6px;
    }

    .indicator-text {
        font-size: 10px;
    }

    .search-section {
        margin-bottom: 15px;
    }

    #searchInput,
    #passwordInput,
    #titleInput {
        padding: 10px;
        font-size: 14px;
        margin-bottom: 10px;
    }

    #searchInput::placeholder,
    #passwordInput::placeholder,
    #titleInput::placeholder {
        font-size: 13px;
    }

    #codeInput {
        min-height: 100px;
        padding: 10px;
        font-size: 12px;
        margin-bottom: 10px;
    }

    .input-section {
        margin-bottom: 20px;
    }

    .content-type-selector {
        gap: 6px;
        flex-wrap: wrap;
    }

    .type-option {
        flex: 1;
        min-width: calc(33% - 6px);
        justify-content: center;
        padding: 8px 6px;
        gap: 4px;
    }

    .type-option span {
        font-size: 11px;
    }

    .hide-content-section {
        margin-bottom: 15px;
    }

    .toggle-container {
        gap: 10px;
    }

    .toggle-slider {
        width: 44px;
        height: 24px;
    }

    .toggle-slider::before {
        width: 18px;
        height: 18px;
    }

    .toggle-container input[type="checkbox"]:checked+.toggle-slider::before {
        transform: translateX(20px);
    }

    .toggle-label {
        font-size: 14px;
    }

    .btn {
        padding: 10px 15px;
        font-size: 13px;
        margin-right: 0;
    }

    .btn-add {
        padding: 12px 20px;
    }

    .backup-controls {
        flex-direction: column;
        gap: 8px;
    }

    .btn-secondary {
        width: 100%;
        padding: 10px 15px;
        font-size: 13px;
    }

    .code-list {
        gap: 12px;
    }

    .code-item {
        padding: 12px;
    }

    .code-title {
        font-size: 15px;
        word-break: break-word;
    }

    .timestamp {
        font-size: 11px;
    }

    .code-content {
        padding: 10px;
        font-size: 12px;
        max-height: 200px;
    }

    .code-actions {
        flex-direction: column;
        gap: 8px;
        margin-top: 12px;
    }

    .btn-copy,
    .btn-delete,
    .btn-download {
        width: 100%;
        min-width: auto;
        padding: 10px 15px;
        font-size: 14px;
    }

    .empty-state,
    .no-results {
        padding: 30px 15px;
        font-size: 16px;
    }

    .snippet-header {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .type-badge {
        padding: 4px 10px;
        font-size: 11px;
    }

    .snippet-content {
        padding: 12px;
        font-size: 12px;
        max-height: 300px;
    }

    .snippet-content.protected {
        padding: 30px 12px;
        min-height: 100px;
        font-size: 13px;
    }

    .eye-unlock-btn {
        top: 8px;
        right: 8px;
        padding: 6px 10px;
        font-size: 16px;
        gap: 6px;
    }

    .eye-unlock-btn .eye-text {
        font-size: 10px;
    }

    .pdf-container {
        min-height: 300px;
    }

    .file-name {
        font-size: 12px;
        padding: 8px 12px;
    }
}

/* New Content Type Styles */
.content-type-selector {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.type-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}

.type-option:hover {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateY(-2px);
}

.type-option input[type="radio"] {
    cursor: pointer;
}

.type-option input[type="radio"]:checked~span {
    color: #667eea;
    font-weight: bold;
}

.type-option span {
    font-size: 14px;
    color: #333;
    transition: all 0.3s;
}

/* File Upload Area - Responsive */
#fileUploadArea {
    margin: 20px 0;
    padding: 30px;
    border: 3px dashed #667eea;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 100%);
    text-align: center;
    transition: all 0.3s;
}

#fileUploadArea:hover {
    border-color: #764ba2;
    background: linear-gradient(135deg, #f0f2ff 0%, #e8ebff 100%);
    transform: scale(1.01);
}

.btn-file-select {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    font-weight: 600;
}

.btn-file-select:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-file-select:active {
    transform: translateY(0);
}

/* File size warning note */
.file-size-note {
    margin-top: 15px;
    padding: 10px 15px;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    border: 1px solid #ffc107;
    border-radius: 8px;
    font-size: 13px;
    color: #856404;
    text-align: center;
    line-height: 1.4;
}

.file-size-note strong {
    color: #664d03;
}

/* iPad and Tablet specific file upload */
@media (min-width: 600px) and (max-width: 991px) {
    #fileUploadArea {
        padding: 25px;
    }

    .btn-file-select {
        padding: 14px 35px;
        font-size: 15px;
    }

    .file-size-note {
        font-size: 12px;
        padding: 8px 12px;
    }
}

/* Mobile specific file upload */
@media (max-width: 599px) {
    #fileUploadArea {
        padding: 20px 15px;
        margin: 15px 0;
    }

    .btn-file-select {
        padding: 12px 25px;
        font-size: 14px;
        width: 100%;
    }

    .file-size-note {
        font-size: 11px;
        padding: 8px 10px;
        margin-top: 12px;
    }
}

.file-preview-container {
    padding: 20px;
    background: white;
    border-radius: 12px;
    margin-top: 20px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-preview-container img {
    max-width: 100%;
    max-height: 250px;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.file-preview-container p {
    color: #666;
    font-size: 14px;
    margin: 10px 0;
    font-weight: 500;
}

.btn-clear-file {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s;
}

.btn-clear-file:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

/* Consolidated file-preview-container (removed duplicate) */
.file-preview-container {
    padding: 20px;
    background: white;
    border-radius: 12px;
    margin-top: 20px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.3s ease-in;
}

.file-preview-container img {
    max-width: 100%;
    max-height: 250px;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.file-preview-container p {
    color: #666;
    font-size: 14px;
    margin: 10px 0;
    font-weight: 500;
}

.snippet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: nowrap;
    gap: 10px;
}

.type-badge {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.snippet-content {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    max-height: 400px;
    overflow-y: auto;
}

.snippet-content:has(.pdf-container),
.snippet-content:has(img) {
    padding: 0;
    background: transparent;
}

.snippet-content.protected {
    background: #1a1a1a;
    color: #ddd;
    text-align: center;
    font-weight: bold;
    padding: 60px 20px;
    font-family: 'Segoe UI', sans-serif;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    filter: blur(10px);
    user-select: none;
    pointer-events: none;
}

.snippet-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.pdf-container {
    width: 100%;
    min-height: 400px;
    margin: 0;
    padding: 0;
}

.pdf-container embed {
    border-radius: 8px;
    border: 1px solid #ddd;
    display: block;
}

.file-name {
    margin: 10px 0 0 0;
    padding: 10px 15px;
    color: #666;
    font-size: 14px;
    font-family: 'Segoe UI', sans-serif;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.btn-download {
    background: linear-gradient(135deg, #6c63ff 0%, #f093fb 100%);
    color: white;
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
}

.btn-download:hover {
    background: linear-gradient(135deg, #5a52d5 0%, #e582ea 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(240, 147, 251, 0.4);
}

/* iPad Landscape specific styles */
@media (min-width: 1024px) and (max-width: 1366px) and (orientation: landscape) {
    .container {
        max-width: 900px;
    }

    .code-actions {
        flex-direction: row;
    }
}

/* iPad Portrait specific styles */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    .container {
        max-width: 100%;
        margin: 0 10px;
    }

    h1 {
        font-size: 2em;
    }

    .auto-update-indicator {
        top: 25px;
        right: 25px;
    }

    .code-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .btn-copy,
    .btn-delete,
    .btn-download {
        flex: 1;
        min-width: 45%;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {

    .btn,
    .btn-add,
    .btn-copy,
    .btn-delete,
    .btn-download,
    .btn-secondary,
    .btn-file-select,
    .type-option {
        min-height: 44px;
    }

    .toggle-slider {
        min-width: 50px;
        min-height: 28px;
    }

    .toggle-slider::before {
        width: 22px;
        height: 22px;
    }

    .eye-unlock-btn {
        min-height: 40px;
        padding: 10px 16px;
    }
}

/* High DPI / Retina displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .code-content {
        -webkit-font-smoothing: antialiased;
    }
}

/* ===== Dark Mode Support ===== */
/* Automatically adapts to system preference */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1e1e2f 0%, #2d1b4e 100%);
    }

    .container {
        background: #1e1e1e;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    }

    h1 {
        color: #e0e0e0;
    }

    .auto-update-indicator {
        background: rgba(102, 126, 234, 0.2);
        color: #a8b4ff;
    }

    #searchInput,
    #passwordInput,
    #titleInput {
        background: #2d2d2d;
        border-color: #404040;
        color: #e0e0e0;
    }

    #searchInput:focus,
    #passwordInput:focus,
    #titleInput:focus {
        border-color: #667eea;
    }

    #searchInput::placeholder,
    #passwordInput::placeholder,
    #titleInput::placeholder {
        color: #888;
    }

    #codeInput {
        background: #2d2d2d;
        border-color: #404040;
        color: #e0e0e0;
    }

    #codeInput:focus {
        border-color: #667eea;
    }

    .type-option {
        background: #2d2d2d;
        border-color: #404040;
    }

    .type-option:hover {
        background: #3a3a4a;
        border-color: #667eea;
    }

    .type-option span {
        color: #e0e0e0;
    }

    .toggle-label {
        color: #e0e0e0;
    }

    .toggle-slider {
        background-color: #555;
    }

    #fileUploadArea {
        background: linear-gradient(135deg, #2d2d3f 0%, #252535 100%);
        border-color: #667eea;
    }

    #fileUploadArea:hover {
        background: linear-gradient(135deg, #35354f 0%, #2d2d45 100%);
    }

    .file-preview-container {
        background: #2d2d2d;
    }

    .file-preview-container p {
        color: #aaa;
    }

    .file-size-note {
        background: linear-gradient(135deg, #3d3520 0%, #2d2810 100%);
        border-color: #ffc107;
        color: #ffc107;
    }

    .code-item {
        background: #2d2d2d;
        border-color: #404040;
    }

    .code-title {
        color: #e0e0e0;
    }

    .timestamp {
        color: #888;
    }

    .code-content {
        background: #1a1a1a;
        color: #e0e0e0;
        border-color: #333;
    }

    .snippet-content {
        background: #1a1a1a;
        color: #e0e0e0;
    }

    .snippet-content.protected {
        background: #0d0d0d;
    }

    .file-name {
        background: #2d2d2d;
        color: #aaa;
    }

    .empty-state,
    .no-results {
        color: #888;
    }

    .highlight {
        background-color: #665500;
        color: #fff;
    }

    /* Dark mode scrollbar */
    .code-content::-webkit-scrollbar-track {
        background: #1a1a1a;
    }

    .code-content::-webkit-scrollbar-thumb {
        background: #555;
    }

    .code-content::-webkit-scrollbar-thumb:hover {
        background: #666;
    }
}

/* ===== Custom Password Modal (Native Browser Prompt Style) ===== */
.password-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.password-modal {
    background: #2b2b2b;
    border-radius: 12px;
    padding: 0;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.password-modal-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid #404040;
}

.password-modal-site {
    font-size: 13px;
    font-weight: 600;
    color: #e0e0e0;
    margin-bottom: 12px;
}

.password-modal-title {
    font-size: 14px;
    font-weight: 400;
    color: #ccc;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.password-modal-body {
    padding: 16px 20px 20px;
}

.password-modal-input {
    width: 100%;
    padding: 8px 0;
    border: none;
    border-bottom: 2px solid #4285f4;
    border-radius: 0;
    font-size: 16px;
    background: transparent;
    color: #fff;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.password-modal-input::placeholder {
    color: #888;
}

.password-modal-input:focus {
    border-bottom-color: #4285f4;
}

.password-modal-error {
    color: #ff6b6b;
    font-size: 13px;
    margin-top: 8px;
    display: none;
}

.password-modal-error.show {
    display: block;
}

.password-modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px 16px;
}

.password-modal-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    min-height: 36px;
}

.password-modal-btn-cancel {
    background: #404040;
    color: #e0e0e0;
}

.password-modal-btn-cancel:hover {
    background: #505050;
}

.password-modal-btn-submit {
    background: #4285f4;
    color: white;
}

.password-modal-btn-submit:hover {
    background: #3275e4;
}

.password-modal-btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Light mode variant */
@media (prefers-color-scheme: light) {
    .password-modal {
        background: #fff;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    }

    .password-modal-header {
        border-bottom-color: #e0e0e0;
    }

    .password-modal-site {
        color: #333;
    }

    .password-modal-title {
        color: #555;
    }

    .password-modal-input {
        color: #333;
        border-bottom-color: #4285f4;
    }

    .password-modal-input::placeholder {
        color: #999;
    }

    .password-modal-btn-cancel {
        background: #e8e8e8;
        color: #333;
    }

    .password-modal-btn-cancel:hover {
        background: #d8d8d8;
    }
}