/* Admin Panel Styles with Dark Theme */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #0f1419;
    color: #e2e8f0;
}

/* Login Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
}

.login-card {
    background: #1a202c;
    border-radius: 16px;
    padding: 3rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid #4a5568;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #f7fafc;
}

.login-header p {
    color: #a0aec0;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    color: #e2e8f0;
}

.form-group input {
    padding: 0.75rem 1rem;
    border: 2px solid #4a5568;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
    background: #2d3748;
    color: #f7fafc;
}

.form-group input::placeholder {
    color: #a0aec0;
}

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

.login-btn {
    padding: 0.75rem 1.5rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.login-btn:hover {
    background: #5a6fd8;
}

.error-message {
    background: #fc8181;
    color: #742a2a;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
}

.login-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

/* Admin Layout */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background: #0f1419;
}

.admin-sidebar {
    width: 250px;
    background: #1a202c;
    color: white;
    flex-shrink: 0;
    border-right: 1px solid #4a5568;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #4a5568;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-item {
    display: block;
    padding: 0.75rem 1.5rem;
    color: #e2e8f0;
    text-decoration: none;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover,
.nav-item.active {
    background: #2d3748;
    border-left-color: #667eea;
    color: #f7fafc;
}

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0f1419;
}

.admin-header {
    background: #1a202c;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #4a5568;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #f7fafc;
}

.admin-user {
    color: #a0aec0;
    font-weight: 500;
}

.admin-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background: #0f1419;
}

/* Content Sections */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

/* Dashboard Styles */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: #1a202c;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    text-align: center;
    border: 1px solid #4a5568;
}

.stat-card h3 {
    color: #a0aec0;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #667eea;
}

.recent-apps {
    background: #1a202c;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border: 1px solid #4a5568;
}

.recent-apps h2 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #f7fafc;
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #f7fafc;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #4a5568;
    color: #e2e8f0;
}

.btn-secondary:hover {
    background: #2d3748;
}

.btn-danger {
    background: #e53e3e;
    color: white;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

.btn-danger:hover {
    background: #c53030;
}

.btn-edit {
    background: #38a169;
    color: white;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

.btn-edit:hover {
    background: #2f855a;
}

/* Apps Table */
.apps-table-container {
    background: #1a202c;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border: 1px solid #4a5568;
}

.apps-table {
    width: 100%;
    border-collapse: collapse;
}

.apps-table th,
.apps-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #4a5568;
}

.apps-table th {
    background: #2d3748;
    font-weight: 600;
    color: #f7fafc;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.apps-table td {
    color: #e2e8f0;
}

.app-icon-small {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}

.platform-badges {
    display: flex;
    gap: 0.25rem;
}

.platform-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

.platform-ios {
    background: #4a5568;
    color: #e2e8f0;
}

.platform-android {
    background: #2f855a;
    color: #c6f6d5;
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

/* Dark App Form */
.app-form {
    background: #1a202c;
    color: #e2e8f0;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border: 1px solid #4a5568;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.app-form .form-group {
    margin-bottom: 1rem;
}

.app-form .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #f7fafc;
}

.app-form .form-group input,
.app-form .form-group select,
.app-form .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #4a5568;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
    font-family: inherit;
    background: #2d3748;
    color: #e2e8f0;
}

.app-form .form-group input::placeholder,
.app-form .form-group textarea::placeholder {
    color: #a0aec0;
}

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

.app-form .form-group textarea {
    resize: vertical;
}

.app-form .form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #a0aec0;
    font-size: 0.8rem;
}

.checkbox-group {
    display: flex;
    gap: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: normal !important;
    color: #e2e8f0;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.form-actions {
    display: flex;
    gap: 1rem;
    padding-top: 2rem;
    border-top: 1px solid #4a5568;
    margin-top: 2rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: normal !important;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.form-actions {
    display: flex;
    gap: 1rem;
    padding-top: 2rem;
    border-top: 1px solid #e2e8f0;
    margin-top: 2rem;
}

/* Apps List */
.apps-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.app-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: #2d3748;
    border-radius: 8px;
    gap: 1rem;
    border: 1px solid #4a5568;
}

.app-item-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    object-fit: cover;
}

.app-item-info {
    flex: 1;
}

.app-item-info h4 {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #f7fafc;
}

.app-item-info p {
    color: #a0aec0;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        order: 2;
    }

    .admin-main {
        order: 1;
    }

    .sidebar-nav {
        display: flex;
        overflow-x: auto;
        padding: 0;
    }

    .nav-item {
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
    }

    .nav-item:hover,
    .nav-item.active {
        border-left: none;
        border-bottom-color: #667eea;
    }
}

@media (max-width: 768px) {
    .admin-content {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .apps-table-container {
        overflow-x: auto;
    }

    .apps-table {
        min-width: 800px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .login-card {
        margin: 1rem;
        padding: 2rem;
    }
}

/* Loading States */
.loading {
    text-align: center;
    padding: 2rem;
    color: #a0aec0;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #a0aec0;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: #e2e8f0;
}

/* Image Upload Styles */
.image-upload-container {
    border: 2px dashed #4a5568;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background: #2d3748;
    transition: border-color 0.3s;
    cursor: pointer;
}

.image-upload-container:hover {
    border-color: #667eea;
}

.image-upload-container.dragover {
    border-color: #667eea;
    background: #374151;
}

.upload-icon {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 1rem;
}

.upload-text {
    color: #e2e8f0;
    margin-bottom: 0.5rem;
}

.upload-subtext {
    color: #a0aec0;
    font-size: 0.9rem;
}

.image-preview {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.preview-item {
    position: relative;
    display: inline-block;
}

.preview-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #4a5568;
}

.remove-image {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.upload-progress {
    margin-top: 1rem;
    display: none;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #4a5568;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #667eea;
    transition: width 0.3s;
    width: 0%;
}

.image-url-input {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #2d3748;
    border: 2px solid #4a5568;
    border-radius: 6px;
    color: #e2e8f0;
    width: 100%;
    font-size: 0.9rem;
}

.image-url-input::placeholder {
    color: #a0aec0;
}

.image-url-input:focus {
    border-color: #667eea;
    outline: none;
}

.url-or-upload {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
    color: #a0aec0;
}

.url-or-upload::before,
.url-or-upload::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #4a5568;
}

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

.content-section.active {
    animation: fadeIn 0.3s ease-out;
}

.stat-card {
    animation: fadeIn 0.6s ease-out;
}

.app-item {
    animation: fadeIn 0.4s ease-out;
}