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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.hidden {
    display: none !important;
}

/* Loading Spinner */
#loading {
    text-align: center;
    color: #6b7280;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#loading p {
    margin-top: 20px;
    font-size: 18px;
    color: #6b7280;
    text-align: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #4b5563;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Login Card */
.login-card {
    background: #ffffff;
    padding: 15px 50px 30px 50px;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 500px;
    width: 100%;
    border: 1px solid #e5e7eb;
}

/* Compact Layout Override */
.login-card.compact-layout {
    padding: 20px 30px 25px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.logo-wrapper {
    margin: 0;
    padding: 0;
    line-height: 0;
    display: block;
}

.logo {
    width: 100%;
    max-width: 380px;
    height: auto;
    margin: 0;
    display: block;
}

.compact-layout .logo {
    max-width: 360px;
}

.logo-container {
    display: flex;
    align-items: center;
    min-width: 300px;
}

.logo-small {
    height: 64px;
    width: auto;
    display: block;
    max-width: 100%;
}

h1 {
    margin-bottom: 30px;
    color: #333;
}

h2 {
    margin-bottom: 36px;
    color: #1f2937;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.qr-info {
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.qr-instruction {
    margin: 8px 0;
    font-size: 14px;
    color: #6b7280;
    padding: 0 20px;
}

.qr-code-container {
    width: 260px;
    height: 260px;
    margin: 0 auto;
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}


.qr-code-container canvas {
    max-width: 100%;
    height: auto;
}

.session-status {
    margin-top: 10px;
    padding: 8px;
    border-radius: 8px;
    background: #f0f0f0;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.session-status.active {
    background: #d4f4dd;
    color: #2e7d32;
}

.session-status.active .status-dot {
    background: #4caf50;
}

/* Header */
header {
    background: #ffffff;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: auto;
}

.user-name-section {
    display: flex;
    align-items: center;
}

.user-name-section span {
    font-size: 15px;
    color: #374151;
    font-weight: 600;
}

.company-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

#company-name {
    font-weight: 500;
    color: #6b7280;
    font-size: 14px;
}

.company-selector {
    padding: 7px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 160px;
}

.company-selector:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.company-selector:focus {
    outline: none;
    border-color: #9ca3af;
    box-shadow: 0 0 0 2px rgba(156, 163, 175, 0.1);
}

.btn-logout {
    padding: 7px 14px;
    background: #ffffff;
    color: #6b7280;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-logout svg {
    width: 14px;
    height: 14px;
    transition: transform 0.15s;
}

.btn-logout:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #ef4444;
}

.btn-logout:hover svg {
    transform: translateX(2px);
}

/* Upload Container */
.upload-container {
    max-width: 800px;
    margin: 100px auto 40px;
    background: #ffffff;
    padding: 48px;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

h2 {
    margin-bottom: 36px;
    color: #1f2937;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed #e5e7eb;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    background: #fafafa;
    position: relative;
    overflow: hidden;
}


.drop-zone:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.drop-zone.drag-over {
    background: #e5e7eb;
    border-color: #6b7280;
    border-style: solid;
}

/* QR Countdown Timer */
.qr-countdown {
    text-align: center;
    margin-top: 12px;
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

/* QR Code Container */
.qr-code-container {
    position: relative;
    display: inline-block;
    margin: 0 auto;
}

/* QR Code Container Animation */
.qr-code-container canvas,
.qr-code-container img {
    animation: fadeIn 0.3s ease-in;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(124, 132, 163, 0.15);
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Full screen drag overlay */
.upload-screen.dragging::before {
    content: 'Slepptu skrám hvar sem er';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(243, 244, 246, 0.95);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #374151;
    font-weight: 500;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    color: #6b7280;
    opacity: 0.7;
}

.drop-text {
    color: #6b7280;
    margin-bottom: 24px;
    font-size: 17px;
    font-weight: 500;
}

.btn-select {
    padding: 12px 32px;
    background: #374151;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.btn-select::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-select:hover {
    background: #1f2937;
}

.btn-select:active::before {
    width: 300px;
    height: 300px;
}

/* Category and Description */
.category-section,
.description-section {
    margin-top: 30px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

select:focus,
textarea:focus {
    outline: none;
    border-color: #9ca3af;
}

/* File List */
.file-list {
    margin-top: 30px;
    padding: 20px;
    background: #fafafa;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.file-list h3 {
    margin-bottom: 15px;
    font-size: 16px;
    color: #666;
}

.btn-clear {
    padding: 6px 12px;
    background: #ffffff;
    color: #6b7280;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-clear:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #ef4444;
}

.file-list ul {
    list-style: none;
}

.file-list li {
    padding: 12px 16px;
    background: #ffffff;
    margin-bottom: 8px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
    border: 1px solid #e5e7eb;
}

.file-list li:hover {
    background: #f3f4f6;
}

.file-name {
    flex: 1;
    margin-right: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.file-name:hover {
    color: #374151;
}

.file-name-input {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid #9ca3af;
    border-radius: 4px;
    font-size: 14px;
    margin-right: 10px;
}

.file-size {
    color: #9ca3af;
    font-size: 13px;
    display: block;
    margin-top: 4px;
}

.btn-action {
    padding: 0;
    background: #ffffff;
    color: #9ca3af;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-action svg {
    width: 16px;
    height: 16px;
    transition: transform 0.15s;
}

.btn-action:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #6b7280;
}

.btn-action:hover svg {
    transform: scale(1.1);
}

.btn-action.btn-rename:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #2563eb;
}

.btn-action.btn-remove:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #dc2626;
}

.btn-action.btn-remove:hover svg {
    transform: scale(1.1) rotate(5deg);
}

/* Upload Button */
.btn-upload {
    width: 100%;
    padding: 16px;
    background: #059669;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 17px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 24px;
    transition: background 0.2s ease;
}

.btn-upload::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-upload:hover {
    background: #047857;
}

.btn-upload:active::before {
    width: 400px;
    height: 400px;
}

.btn-upload:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Progress */
.upload-progress {
    margin-top: 30px;
}

.progress-bar {
    height: 36px;
    background: linear-gradient(145deg, #f3f4f6, #e5e7eb);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
    position: relative;
}

.progress-fill {
    height: 100%;
    background: #059669;
    border-radius: 18px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

#progress-text {
    text-align: center;
    margin-top: 12px;
    color: #6b7280;
    font-weight: 500;
}

/* Success Message */
.success-message {
    text-align: center;
    padding: 20px 24px;
    background: #f0fdf4;
    border-radius: 8px;
    margin-top: 24px;
    border: 1px solid #86efac;
    animation: fadeIn 0.3s ease;
}

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

.success-message p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #059669;
}

.success-icon {
    width: 40px;
    height: 40px;
    color: #10b981;
    margin: 0 auto 12px;
}

.btn-new {
    padding: 14px 36px;
    background: #059669;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    margin-top: 24px;
    transition: background 0.2s ease;
}

.btn-new:hover {
    background: #047857;
}

/* Modal */
.modal {
    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: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    max-width: 400px;
    width: 90%;
}

.modal-content h3 {
    margin-bottom: 15px;
    color: #f44336;
}

.btn-close {
    padding: 10px 20px;
    background: #666;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 20px;
}

/* File List Improvements */
.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.file-icon {
    font-size: 32px;
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.file-details {
    flex: 1;
    min-width: 0;
    margin-left: 12px;
}

.file-name {
    font-size: 15px;
    font-weight: 500;
    color: #1f2937;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-preview {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.file-preview:hover {
    transform: scale(1.05);
    border-color: #9ca3af;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.file-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-preview {
    padding: 4px 8px;
    background: #6b7280;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.btn-preview:hover {
    background: #4b5563;
}

/* Preview Modal */
.preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.preview-header {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.preview-header button {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.preview-header button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.preview-content {
    max-width: 90%;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.preview-content iframe {
    width: 90vw;
    height: 80vh;
    border: none;
    border-radius: 8px;
    background: white;
}

.preview-filename {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    max-width: 80%;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Responsive */
@media (max-width: 768px) {
    .login-card.compact-layout {
        padding: 15px 20px 20px 20px;
        margin: 10px;
        gap: 5px;
    }

    .compact-layout .logo {
        max-width: 280px;
    }

    .qr-code-container {
        width: 240px;
        height: 240px;
        padding: 15px;
    }

    .qr-code-container canvas {
        width: 210px !important;
        height: 210px !important;
    }

    .qr-instruction {
        font-size: 13px;
        margin: 5px 0;
    }

    .session-status {
        margin-top: 5px;
        font-size: 13px;
    }
}

/* Small phones */
@media (max-width: 375px) {
    .login-card.compact-layout {
        padding: 12px 15px 18px 15px;
    }

    .compact-layout .logo {
        max-width: 240px;
    }

    .qr-code-container {
        width: 200px;
        height: 200px;
        padding: 12px;
    }

    .qr-code-container canvas {
        width: 176px !important;
        height: 176px !important;
    }

    .upload-container {
        margin-top: 80px;
        padding: 20px;
    }

    .drop-zone {
        padding: 40px 20px;
    }

    .header-content {
        flex-direction: column;
        gap: 10px;
    }

    .user-info {
        flex-direction: column;
        text-align: center;
    }

    .file-info {
        flex-direction: column;
        align-items: flex-start;
    }

    .preview-modal {
        padding: 10px;
    }

    .preview-content iframe {
        width: 100%;
        height: 70vh;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background: #0f0f0f;
        color: #e5e7eb;
    }

    .container {
        background: #0f0f0f;
    }

    #loading {
        color: #e5e7eb;
    }

    #loading p {
        color: #9ca3af;
    }

    .loading-spinner {
        border-color: rgba(107, 114, 128, 0.3);
        border-top-color: #6b7280;
    }

    .login-card {
        background: #1a1a1a;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .qr-code-container {
        background: linear-gradient(145deg, #1f1f1f, #2a2a2a);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .qr-code-container::before {
        opacity: 0.05;
    }

    .session-status {
        background: #1f1f1f;
        color: #9ca3af;
    }

    .session-status.active {
        background: #1a3a1a;
        color: #4ade80;
    }

    header {
        background: rgba(26, 26, 26, 0.95);
        box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .user-info span {
        color: #9ca3af;
    }

    #company-name {
        color: #9ca3af;
    }

    .company-selector {
        background: #1f1f1f;
        border-color: #374151;
        color: #9ca3af;
    }

    .btn-logout {
        background: #dc2626;
    }

    .btn-logout:hover {
        background: #b91c1c;
    }

    .upload-container {
        background: #1a1a1a;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    h1, h2 {
        color: #f3f4f6;
    }

    .drop-zone {
        background: linear-gradient(145deg, #1f1f1f, #2a2a2a);
        border-color: #374151;
    }

    .drop-zone:hover {
        background: #2a2a2a;
        border-color: #4b5563;
    }

    .drop-zone.drag-over {
        background: linear-gradient(145deg, #2a2a2a, #333333);
    }

    .upload-icon {
        color: #6b7280;
    }

    .drop-text {
        color: #9ca3af;
    }

    .file-list {
        background: linear-gradient(145deg, #1f1f1f, #2a2a2a);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .file-list li {
        background: #1a1a1a;
        border-color: rgba(255, 255, 255, 0.1);
    }

    .file-list li:hover {
        background: #2a2a2a;
        border-color: #4b5563;
    }

    .file-name {
        color: #e5e7eb;
    }

    .file-size {
        color: #6b7280;
    }

    .btn-action {
        background: transparent;
        color: #9ca3af;
        border-color: #374151;
    }

    .btn-action:hover {
        background: #374151;
        border-color: #4b5563;
    }

    .btn-action.btn-remove:hover {
        background: #7f1d1d;
        border-color: #991b1b;
        color: #fca5a5;
    }

    .btn-clear {
        background: #1f1f1f;
        border-color: #374151;
        color: #9ca3af;
    }

    .btn-clear:hover {
        background: #7f1d1d;
        border-color: #991b1b;
        color: #fca5a5;
    }

    .progress-bar {
        background: linear-gradient(145deg, #1f1f1f, #2a2a2a);
    }

    #progress-text {
        color: #9ca3af;
    }

    .success-message {
        background: linear-gradient(145deg, #1a3a1a, #2a4a2a);
        border-color: rgba(76, 175, 80, 0.3);
    }

    .modal {
        background: rgba(0, 0, 0, 0.8);
    }

    .modal-content {
        background: #1a1a1a;
        color: #e5e7eb;
    }

    .preview-modal {
        background: rgba(0, 0, 0, 0.95);
    }

    .preview-header button {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.2);
    }

    .preview-header button:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    .preview-filename {
        background: rgba(0, 0, 0, 0.9);
    }

    select, textarea {
        background: #1f1f1f;
        border-color: #374151;
        color: #e5e7eb;
    }

    select:focus, textarea:focus {
        border-color: #6b7280;
    }

    .file-name-input {
        background: #1f1f1f;
        border-color: #6b7280;
        color: #e5e7eb;
    }
}