* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 40px 20px;
    position: relative;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
}

/* User Authentication Section */
.user-auth-section {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#loginSection {
    text-align: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.15);
    padding: 10px 20px;
    border-radius: 50px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-details {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.user-name {
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.logout-link, .admin-link {
    color: white;
    text-decoration: none;
    font-size: 13px;
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    transition: all 0.3s;
}

.logout-link:hover, .admin-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* Notifications */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--bg-color);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.btn-primary, .btn-secondary, .btn-download {
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    margin-top: 15px;
}

.btn-secondary:hover {
    background: white;
    border-color: var(--primary-color);
}

.btn-download {
    background: var(--success-color);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    margin-bottom: 10px;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.loader {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.status-message {
    margin-top: 20px;
    padding: 16px;
    border-radius: 10px;
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.status-message.info {
    background: rgba(59, 130, 246, 0.1);
    border: 2px solid rgba(59, 130, 246, 0.3);
    color: #1e40af;
}

.status-message.success {
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid rgba(16, 185, 129, 0.3);
    color: #065f46;
}

.status-message.error {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid rgba(239, 68, 68, 0.3);
    color: #991b1b;
}

.download-section {
    text-align: center;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 20px;
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.download-section h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.app-info {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: left;
    line-height: 1.8;
}

.info-section {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    margin-bottom: 30px;
}

.info-section h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-primary);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.info-card {
    text-align: center;
    padding: 20px;
    border-radius: 15px;
    background: var(--bg-color);
    transition: transform 0.3s ease;
}

.info-card:hover {
    transform: translateY(-5px);
}

.step-number {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 auto 15px;
}

.info-card h3 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.info-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

footer {
    text-align: center;
    color: white;
    padding: 20px;
    opacity: 0.9;
}

/* File Upload Styles */
.file-upload-wrapper {
    position: relative;
}

.file-input {
    display: none;
}

.file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 20px;
    background: var(--bg-color);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: var(--text-secondary);
}

.file-label:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
    color: var(--primary-color);
}

.file-icon {
    font-size: 1.5rem;
}

.file-text {
    font-size: 0.95rem;
}

/* Icon Preview */
.icon-preview {
    margin-top: 15px;
    position: relative;
    display: inline-block;
}

.icon-preview img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 3px solid var(--primary-color);
}

.remove-icon {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 30px;
    height: 30px;
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.remove-icon:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Icon Selection Tabs */
.icon-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.icon-tab {
    flex: 1;
    padding: 12px 20px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    color: var(--text-secondary);
}

.icon-tab:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.icon-tab.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.icon-tab-content {
    display: none;
}

.icon-tab-content.active {
    display: block;
}

/* Icon Gallery Grid */
.icon-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
    padding: 15px;
    background: var(--bg-color);
    border-radius: 8px;
    max-height: 350px;
    overflow-y: auto;
}

.gallery-icon-item {
    background: white;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid #e5e7eb;
    text-align: center;
    position: relative;
}

.gallery-icon-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
    border-color: var(--primary-color);
}

.gallery-icon-item.selected {
    border-color: var(--success-color);
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    box-shadow: 0 5px 20px rgba(16, 185, 129, 0.4);
    transform: scale(1.05);
}

.gallery-icon-item.selected::after {
    content: '✓';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 25px;
    height: 25px;
    background: var(--success-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.gallery-icon-item img {
    width: 100%;
    height: 60px;
    object-fit: contain;
    margin-bottom: 5px;
}

.gallery-icon-name {
    font-size: 10px;
    color: var(--text-secondary);
    word-break: break-word;
    line-height: 1.2;
}

.gallery-icon-item.selected .gallery-icon-name {
    color: var(--success-color);
    font-weight: bold;
}

.loading-icons {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.no-icons-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* Permissions Section */
.permissions-info {
    background: #f0f9ff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid var(--primary-color);
}

.permissions-info p {
    margin: 0;
    color: #1e40af;
    font-size: 14px;
}

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}

.permission-item {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.3s ease;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.permission-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

.permission-item.permission-required {
    background: #f9fafb;
    border-color: #d1d5db;
    opacity: 0.8;
}

.permission-item input[type="checkbox"] {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.permission-item input[type="checkbox"]:disabled {
    cursor: not-allowed;
}

.permission-item input[type="checkbox"]:checked + label {
    color: var(--primary-color);
}

.permission-item label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    flex: 1;
}

.permission-item.permission-required label {
    cursor: default;
}

.permission-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.permission-info {
    flex: 1;
}

.permission-info strong {
    display: block;
    font-size: 15px;
    color: #1f2937;
    margin-bottom: 3px;
}

.permission-info small {
    display: block;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}

.permissions-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-secondary {
    padding: 10px 20px;
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Selected Icon Info */
.selected-icon-info {
    margin-top: 15px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 2px solid var(--success-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.selected-icon-badge {
    font-weight: bold;
    color: var(--success-color);
    font-size: 14px;
}

.selected-icon-name {
    font-weight: 600;
    color: #065f46;
    font-size: 14px;
    background: white;
    padding: 4px 12px;
    border-radius: 12px;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .card {
        padding: 25px;
    }
    
    .info-section {
        padding: 25px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .icon-preview img {
        width: 100px;
        height: 100px;
    }
}

