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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a2e;
    min-height: 100vh;
    color: #333;
}

/* Login page background */
.login-bg {
    background-image: url('/background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    position: relative;
}

.login-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.25);
}

.login-bg .container {
    position: relative;
    z-index: 1;
}

/* Master pages background (subtle) */
.master-bg {
    background-image: url('/background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    position: relative;
}

.master-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 1) 0%, rgba(118, 75, 162, 0.6) 100%);
}

.master-bg .container {
    position: relative;
    z-index: 1;
}

.login-title {
    text-align: center;
    color: white;
    font-size: 3em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
    font-weight: 600;
    letter-spacing: 1px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.page {
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* Login/Register */
.auth-form {
background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(3px);
  padding: 50px;
  border-radius: 20px;
  max-width: 450px;
  margin: 160px auto;
}

.auth-form h2 {
    margin-bottom: 40px;
    color: #ffffff;
    text-align: center;
    font-size: 3em;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-shadow: 2px 4px 8px rgba(0, 0, 0, 0.3);
}

.auth-form input {
    width: 100%;
    padding: 15px;
    margin-bottom: 20px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.9);
}

.auth-form input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.auth-form button {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
    margin-top: 10px;
}

.auth-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.auth-form .auth-description {
    margin-bottom: 20px;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    font-size: 14px;
}

.auth-form .auth-link {
    margin-top: 15px;
    text-align: center;
}

.auth-form p {
    margin-top: 15px;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
}

.auth-form a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.auth-form a:hover {
    color: #e0e7ff;
    text-decoration: underline;
}

#forgot-password-link {
    margin-top: 10px;
    margin-bottom: 5px;
    font-size: 14px;
}

.success {
    color: #10b981 !important;
    font-size: 14px;
    margin-top: 15px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.error {
    color: #ef4444 !important;
    font-size: 14px;
    margin-top: 15px;
    display: block;
    min-height: 20px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Dashboard */
.dashboard-header {
    margin-bottom: 40px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
}

.header-top {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    width: 100%;
}

.header-top h1 {
    color: white;
    font-size: 32px;
    font-weight: 700;
    margin: 0;
    margin-right: auto;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-actions {
    display: flex;
    gap: 10px;
}

.header-btn {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.header-create {
    display: flex;
    gap: 12px;
    width: 100%;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.header-create input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.95);
    transition: all 0.3s;
}

.header-create input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    background: white;
}

.header-create input[type="number"] {
    flex: 0 0 140px;
}

.header-create select {
    flex: 0 0 160px;
    padding: 14px 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.95);
    cursor: pointer;
    transition: all 0.3s;
}

.header-create select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    background: white;
}

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

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

/* Old header styles (fallback for other pages) */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding: 25px 30px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

header h1 {
    color: white;
    font-size: 28px;
    font-weight: 700;
    margin: 0;
}

#logout-btn {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
}

#logout-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.create-section {
    display: flex;
    gap: 12px;
    margin-bottom: 40px;
    padding: 25px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.create-section input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.95);
    transition: all 0.3s;
}

.create-section input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    background: white;
}

.create-section input[type="number"] {
    flex: 0 0 140px;
}

.create-section select {
    flex: 0 0 160px;
    padding: 14px 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.95);
    cursor: pointer;
    transition: all 0.3s;
}

.create-section select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    background: white;
}

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

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

#slideshows-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.slideshow-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.slideshow-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
}

.slideshow-card .card-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.slideshow-card .card-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}

.slideshow-card h3 {
    color: white;
    margin: 0;
    flex: 1;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.4;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slideshow-card .slideshow-title {
    color: white !important;
}

.slideshow-card .slideshow-info {
    flex: 1;
}

.slideshow-card .slideshow-edit-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.slideshow-card .slideshow-edit-fields label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: -5px;
}

.slideshow-card .slideshow-title-edit {
    flex: 1;
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 600;
    color: #667eea;
    border: 2px solid #e0e7ff;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s;
}

.slideshow-card .slideshow-duration-edit {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    color: #667eea;
    border: 2px solid #e0e7ff;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s;
}

.slideshow-card .slideshow-order-edit {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    color: #667eea;
    border: 2px solid #e0e7ff;
    border-radius: 8px;
    outline: none;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s;
}

.slideshow-card .slideshow-title-edit:focus,
.slideshow-card .slideshow-duration-edit:focus,
.slideshow-card .slideshow-order-edit:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    background: #fafbff;
}

.slideshow-card .slideshow-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.slideshow-card .slideshow-timestamp {
    margin-top: 15px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.slideshow-card .duration-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(102, 126, 234, 0.25);
    color: #c7d2fe;
    border: 1px solid rgba(167, 139, 250, 0.4);
}

.slideshow-card .order-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(52, 211, 153, 0.25);
    color: #6ee7b7;
    border: 1px solid rgba(52, 211, 153, 0.4);
}

.slideshow-card .card-actions {
    display: flex;
    gap: 6px;
}

.slideshow-card .edit-btn,
.slideshow-card .delete-btn,
.slideshow-card .save-btn,
.slideshow-card .cancel-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.slideshow-card .edit-btn:hover {
    background: rgba(102, 126, 234, 0.15);
    transform: scale(1.1);
}

.slideshow-card .delete-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    transform: scale(1.1);
}

.slideshow-card .save-btn {
    color: #10b981;
    font-size: 22px;
}

.slideshow-card .save-btn:hover {
    background: rgba(16, 185, 129, 0.15);
    transform: scale(1.1);
}

.slideshow-card .cancel-btn {
    color: #ef4444;
    font-size: 22px;
}

.slideshow-card .cancel-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    transform: scale(1.1);
}

.slideshow-card .status {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-draft {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
}

.status-active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.status-finished {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(107, 114, 128, 0.3);
}

/* Slideshow Page */
.slideshow-header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 30px;
}

.slideshow-header h2 {
    color: white;
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.slideshow-header button {
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.slideshow-header button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

#download-all-btn.is-loading {
    cursor: wait;
    opacity: 0.8;
    transform: none;
}

#download-all-btn.is-loading::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: download-spinner 0.8s linear infinite;
}

@keyframes download-spinner {
    to {
        transform: rotate(360deg);
    }
}

#back-to-dashboard {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

#back-to-dashboard:hover {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

#end-session-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    margin-left: auto;
}

#end-session-btn:hover {
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4) !important;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    padding: 50px;
    border-radius: 20px;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(102, 126, 234, 0.2);
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    color: #667eea;
    margin-bottom: 30px;
    font-size: 28px;
    font-weight: 700;
}

.close {
    position: absolute;
    right: 25px;
    top: 20px;
    font-size: 32px;
    cursor: pointer;
    color: #999;
    transition: all 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: rotate(90deg);
}

#qr-code {
    margin: 30px 0;
    display: flex;
    justify-content: center;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#client-url {
    margin-top: 25px;
    padding: 15px 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 10px;
    word-break: break-all;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

/* Photo Gallery */
#photo-gallery {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    padding: 35px;
    border-radius: 20px;
    margin-top: 30px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

#photo-gallery h3 {
    color: white;
    margin-bottom: 25px;
    font-size: 24px;
    font-weight: 700;
}

#gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
}

.gallery-item {
    position: relative;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.gallery-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.3);
    border-color: rgba(102, 126, 234, 0.3);
}

.gallery-item img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
    cursor: pointer;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item-info {
    padding: 12px 15px;
    background: white;
}

.gallery-item-message {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    max-height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    font-weight: 500;
}

.gallery-item-date {
    font-size: 11px;
    color: #999;
    font-weight: 500;
}

.gallery-item-delete {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    opacity: 0;
    z-index: 10;
}

.gallery-item:hover .gallery-item-delete {
    opacity: 1;
}

/* On mobile/touch devices, always show delete button */
@media (hover: none) {
    .gallery-item-delete {
        opacity: 0.85;
    }

    .gallery-item-delete:hover {
        opacity: 1;
    }
}

.gallery-item-delete:hover {
    transform: scale(1.15) rotate(90deg);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.6);
}

/* Lightbox for full-size images */
#lightbox {
    background-color: rgba(0, 0, 0, 0.95);
    cursor: pointer;
}

#lightbox img {
    cursor: default;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

#lightbox .close {
    position: absolute;
    top: 30px;
    right: 40px;
    font-size: 50px;
    color: white;
    cursor: pointer;
    z-index: 1001;
    transition: transform 0.3s;
}

#lightbox .close:hover {
    transform: scale(1.2) rotate(90deg);
}
