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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
}

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-header {
    background: linear-gradient(135deg, #00A86B, #008f5c);
    color: white;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.admin-header h1 {
    font-size: 1.8rem;
    margin: 0;
}

.auth-status {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.75rem;
    font-size: 0.95rem;
}

.logout-btn {
    padding: 0.5rem 1rem;
}

.admin-nav {
    background-color: white;
    padding: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.nav-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    background: white;
    color: #102A43;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.nav-btn:hover, .nav-btn.active {
    background: #00A86B;
    color: white;
}

.admin-main {
    flex: 1;
    padding: 2rem;
    background-color: #f9fafb;
}

.admin-section {
    display: none;
}

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

.requires-auth.locked {
    display: none !important;
}

.admin-section h2 {
    color: #102A43;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

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

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card i {
    font-size: 2.5rem;
    color: #00A86B;
    margin-bottom: 0.5rem;
}

.stat-card h3 {
    font-size: 2rem;
    color: #102A43;
    margin: 0.5rem 0;
}

.stat-card p {
    color: #666;
    margin: 0;
}

/* Quick Actions */
.quick-actions {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.quick-actions h3 {
    margin-bottom: 1rem;
    color: #102A43;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    color: #102A43;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    border-color: #00A86B;
    background: #e6f7f0;
    transform: translateY(-3px);
}

.action-btn i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Content Lists */
.btn-primary {
    background: #00A86B;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: #008f5c;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.content-list {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    overflow: hidden;
}

.content-item {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-item:last-child {
    border-bottom: none;
}

.content-info h3 {
    color: #102A43;
    margin-bottom: 0.25rem;
}

.content-info p {
    color: #666;
    font-size: 0.9rem;
}

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

/* Company Form */
#company-form {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    max-width: 800px;
}

.form-group {
    margin-bottom: 1.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #102A43;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Image Upload Styling */
.image-preview {
    margin-top: 0.5rem;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #ccc;
    border-radius: 8px;
    overflow: hidden;
}

.image-preview img {
    max-width: 100%;
    max-height: 200px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: modalSlideIn 0.3s ease;
    /* Ensure modal content can scroll when it's taller than the viewport */
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Login overlay */
.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1500;
    padding: 1rem;
}

.login-card {
    background: white;
    width: 100%;
    max-width: 420px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    padding: 2rem;
    text-align: left;
}

.login-card h2 {
    margin-bottom: 0.5rem;
    color: #102A43;
}

.muted {
    color: #6c757d;
    margin-bottom: 1rem;
}

.login-form .form-group label {
    color: #102A43;
}

.login-form .form-group input {
    border: 1px solid #d1d9e0;
}

.error-text {
    color: #dc3545;
    min-height: 1.2rem;
    margin-top: 0.5rem;
}

.full-width {
    width: 100%;
    justify-content: center;
}

.login-overlay.hidden {
    display: none;
}

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

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.close:hover {
    color: #dc3545;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

/* Responsive Design */
@media (max-width: 768px) {
    .admin-nav {
        flex-direction: column;
    }
    
    .nav-btn {
        width: 100%;
    }
    
    .admin-main {
        padding: 1rem;
    }
    
    .stats-container,
    .actions-grid,
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .content-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .content-actions {
        align-self: flex-end;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }
}