/* Modern Design System */
:root {
    /* Primary Colors - Warm, Professional */
    --primary: #2563eb;           /* Blue 600 */
    --primary-dark: #1d4ed8;     /* Blue 700 */
    --primary-light: #3b82f6;    /* Blue 500 */
    
    /* Secondary Colors */
    --secondary: #059669;        /* Emerald 600 */
    --secondary-dark: #047857;   /* Emerald 700 */
    --secondary-light: #10b981;  /* Emerald 500 */
    
    /* Accent Colors */
    --accent: #f59e0b;           /* Amber 500 */
    --accent-light: #fbbf24;     /* Amber 400 */
    
    /* Neutral Colors */
    --background: #f8fafc;       /* Slate 50 */
    --surface: #ffffff;          /* White */
    --surface-secondary: #f1f5f9; /* Slate 100 */
    
    /* Text Colors */
    --text-primary: #0f172a;     /* Slate 900 */
    --text-secondary: #475569;  /* Slate 600 */
    --text-light: #64748b;       /* Slate 500 */
    --text-white: #ffffff;
    
    /* Border & Shadow */
    --border: #e2e8f0;           /* Slate 200 */
    --border-light: #f1f5f9;     /* Slate 100 */
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Status Colors */
    --success: #10b981;          /* Emerald 500 */
    --warning: #f59e0b;          /* Amber 500 */
    --error: #ef4444;            /* Red 500 */
    --info: #3b82f6;             /* Blue 500 */
    
    /* Spacing */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: all 0.2s ease-in-out;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* Step Management */
.step {
    display: none;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.step.active {
    display: block;
}

.step-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 40px;
    border: 1px solid var(--border-light);
}

/* Header & Navigation */
.step-header {
    display: flex;
    align-items: center;
    margin-bottom: 32px;
    gap: 16px;
}

.btn-back {
    background: var(--surface-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.btn-back:hover {
    background: var(--border);
    color: var(--text-primary);
}

.step-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
}

.step-number {
    background: var(--primary);
    color: var(--text-white);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.step-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Logo - for step forms */
.step-content > .logo {
    text-align: center;
    margin-bottom: 32px;
}

.step-content > .logo i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 16px;
    display: block;
}

.step-content > .logo h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 40px;
}

/* Forms */
.form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.input-group input {
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    transition: var(--transition);
    background: var(--surface);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-group input::placeholder {
    color: var(--text-light);
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--text-white);
    border: none;
    border-radius: var(--radius);
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-primary.loading {
    pointer-events: none;
}

.btn-loading {
    display: none;
}

.btn-primary.loading .btn-text {
    display: none;
}

.btn-primary.loading .btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Photo Upload */
.photo-upload {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.photo-upload-area {
    cursor: pointer;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    transition: var(--transition);
    background: var(--surface-secondary);
}

.photo-upload-area:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.photo-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
}

.photo-preview img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
}

.photo-preview i {
    font-size: 32px;
    color: var(--text-light);
}

.photo-preview span {
    font-size: 14px;
    font-weight: 500;
}

/* Photo Manager */
.photo-manager {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.upload-section {
    margin-bottom: 24px;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--surface-secondary);
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: var(--text-secondary);
}

.upload-content i {
    font-size: 48px;
    color: var(--primary);
}

.upload-content h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.upload-content p {
    font-size: 14px;
    color: var(--text-light);
}

/* Media Grid */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.media-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    background: var(--surface);
    border: 1px solid var(--border-light);
}

.media-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.media-item img,
.media-item video {
    width: 100%;
    height: 200px;
    object-fit: cover;
    /* Performance optimizations */
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
    /* Smooth loading */
    transition: opacity 0.3s ease-in-out;
}

.media-item .delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    opacity: 0;
}

.media-item:hover .delete-btn {
    opacity: 1;
}

.media-item .delete-btn:hover {
    background: var(--error);
    transform: scale(1.1);
}

/* Loading States */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-light);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.loading-progress {
    width: 200px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 12px;
}

.loading-progress .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 2px;
    transition: width 0.3s ease;
}

.loading-spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Skeleton Loading */
.media-skeleton {
    position: relative;
    width: 100%;
    height: 200px;
    background: var(--surface-secondary);
    border-radius: var(--radius);
    overflow: hidden;
}

.skeleton-content {
    width: 100%;
    height: 100%;
    position: relative;
}

.skeleton-image,
.skeleton-video {
    width: 100%;
    height: 80%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius) var(--radius) 0 0;
}

.skeleton-video {
    background: linear-gradient(90deg, #d0d0d0 25%, #c0c0c0 50%, #d0d0d0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-text {
    width: 100%;
    height: 20%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0 0 var(--radius) var(--radius);
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

.error-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: var(--surface-secondary);
    color: var(--text-light);
    font-size: 12px;
    text-align: center;
    border-radius: var(--radius);
}

/* Upload Progress */
.upload-item {
    border: 2px dashed var(--primary);
    background: var(--surface);
}

.upload-skeleton {
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.upload-content {
    text-align: center;
    color: var(--text-light);
}

.upload-icon {
    font-size: 24px;
    margin-bottom: 8px;
    animation: bounce 1s infinite;
}

.upload-text {
    font-size: 12px;
    margin-bottom: 12px;
    font-weight: 500;
}

.upload-progress {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 2px;
    animation: progress 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-4px); }
    60% { transform: translateY(-2px); }
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Responsive Design */
@media (max-width: 640px) {
    .app {
        padding: 16px;
    }
    
    .step-content {
        padding: 24px;
    }
    
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .media-item img,
    .media-item video {
        height: 150px;
    }
    
    .media-skeleton {
        height: 150px;
    }
}

/* Header Layout */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo i {
    font-size: 32px;
    color: var(--primary);
}

.logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.btn-logout {
    background: var(--surface-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 16px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.btn-logout:hover {
    background: var(--border);
    color: var(--text-primary);
}

/* Tablet Management */
.tablets-section {
    margin-bottom: 24px;
}

.tablets-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.tablet-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
}

.tablet-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.tablet-info h4 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.tablet-info p {
    font-size: 14px;
    color: var(--text-light);
    margin: 0;
}

.tablet-actions {
    display: flex;
    gap: 12px;
}

.tablet-actions .btn-primary {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-light {
    color: var(--text-light);
}

.error {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid rgba(239, 68, 68, 0.2);
    text-align: center;
}