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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f7fa;
    min-height: 100vh;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navbar */
.navbar {
    background: #fff;
    color: #1e293b;
    padding: 12px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    color: #1e293b;
    font-size: 1.4em;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-logo {
    height: 32px;
    width: auto;
}

.nav-links {
    display: flex;
    gap: 16px;
    align-items: center;
}

.nav-links a {
    color: #475569;
    font-size: 0.95em;
    white-space: nowrap;
}

.nav-links a:hover, .nav-links a.nav-profile {
    color: #1e293b;
}

.nav-logout {
    color: #f87171 !important;
}

/* Hero */
.hero {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #fff;
    margin-bottom: 32px;
}

.hero h1 {
    font-size: 2em;
    margin-bottom: 12px;
}

.hero-subtitle {
    color: #94a3b8;
    font-size: 1.1em;
}

/* Flash Messages */
.flash {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 500;
}

.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    border: 1px solid transparent;
    font-size: 0.95em;
    text-decoration: none;
    transition: background 0.2s;
}

.btn:hover { text-decoration: none; }

.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }

.btn-secondary { background: #e2e8f0; color: #475569; border-color: #cbd5e1; }
.btn-secondary:hover { background: #cbd5e1; }

.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }

.btn-warning { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; }

.btn-small { padding: 6px 14px; font-size: 0.85em; }
.btn-block { display: block; width: 100%; }

/* Auth Forms */
.auth-form {
    max-width: 460px;
    margin: 40px auto;
    padding: 32px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.auth-form h1 {
    margin-bottom: 24px;
    font-size: 1.5em;
}

.auth-link {
    text-align: center;
    margin-top: 16px;
    color: #64748b;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #374151;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

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

.help-text {
    color: #64748b;
    font-size: 0.9em;
    margin-top: 4px;
}

/* Ads Grid */
.ads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.ad-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: box-shadow 0.2s;
}

.ad-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.ad-card-preview {
    position: relative;
}

.ad-card-preview .blur-content {
    filter: blur(4px);
    pointer-events: none;
}

.ad-card h3 {
    font-size: 1.1em;
    color: #1e293b;
}

.ad-card h3 a {
    color: #1e293b;
    text-decoration: none;
}

.ad-card h3 a:hover {
    color: #2563eb;
}

.ad-location { color: #64748b; font-size: 0.95em; }
.ad-salary { color: #16a34a; font-weight: 600; }
.ad-date { color: #94a3b8; font-size: 0.85em; }

/* Filters */
.filters-form {
    margin-bottom: 24px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-row input,
.filter-row select {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95em;
    flex: 1;
    min-width: 150px;
}

/* Ad Detail */
.ad-detail {
    background: #fff;
    border-radius: 8px;
    padding: 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.ad-detail h2 {
    font-size: 1.5em;
    margin-bottom: 8px;
}

.ad-detail h3 {
    margin-top: 20px;
    margin-bottom: 8px;
    color: #1e293b;
}

.ad-company-info {
    color: #64748b;
    margin-bottom: 12px;
}

.ad-meta {
    display: flex;
    gap: 24px;
    color: #64748b;
    margin: 12px 0;
}

.ad-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.ad-photos img {
    max-width: 250px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
    margin-bottom: 16px;
}

.status-pending { background: #fef3c7; color: #92400e; }
.status-rejected { background: #fef2f2; color: #991b1b; }

.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
}

.role-admin { background: #fee2e2; color: #991b1b; }
.role-moderator { background: #fef3c7; color: #92400e; }
.role-employer { background: #dbeafe; color: #1e40af; }
.role-worker { background: #dcfce7; color: #166534; }

/* Applications */
.applications-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.application-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.application-card h3 {
    margin-bottom: 8px;
}

.app-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    margin: 8px 0;
}

.status-pending { background: #fef3c7; color: #92400e; }
.status-accepted { background: #dcfce7; color: #166534; }
.status-rejected { background: #fef2f2; color: #991b1b; }

.app-message {
    background: #f8fafc;
    padding: 12px;
    border-radius: 6px;
    margin: 8px 0;
    font-size: 0.95em;
}

.app-date {
    color: #94a3b8;
    font-size: 0.85em;
}

.app-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* Messages */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message-item {
    display: block;
    padding: 14px 16px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    text-decoration: none;
    color: inherit;
}

.message-item:hover {
    background: #f8fafc;
}

.message-item.unread {
    border-left: 3px solid #2563eb;
    font-weight: 500;
}

.conversation {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
    max-height: 500px;
    overflow-y: auto;
    padding: 16px;
    background: #fff;
    border-radius: 8px;
}

.message {
    display: flex;
}

.message-sent {
    justify-content: flex-end;
}

.message-received {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 12px;
    background: #f1f5f9;
}

.message-sent .message-bubble {
    background: #2563eb;
    color: #fff;
}

.message-bubble small {
    display: block;
    margin-top: 4px;
    font-size: 0.8em;
    opacity: 0.7;
}

.message-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.message-form textarea {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    resize: none;
}

/* Pending List */
.pending-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pending-card {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.count-badge {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.9em;
    margin-bottom: 16px;
}

/* Moderation */
.moderation-form {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.moderation-actions {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    flex-wrap: wrap;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stat-card h3 {
    font-size: 2em;
    color: #2563eb;
}

.stat-card p {
    color: #64748b;
    font-size: 0.9em;
}

/* Tables */
.users-table, .moderators-list table {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

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

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

th {
    background: #f8fafc;
    font-weight: 600;
    color: #374151;
    font-size: 0.9em;
}

td {
    font-size: 0.95em;
}

.status-active { color: #16a34a; font-weight: 500; }
.status-inactive { color: #dc2626; font-weight: 500; }

/* Profile */
.profile-logo, .profile-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e5e7eb;
    margin: 12px 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    color: #94a3b8;
    padding: 40px 20px;
    font-size: 1.1em;
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 24px 0;
    color: #94a3b8;
    font-size: 0.9em;
    border-top: 1px solid #e5e7eb;
    margin-top: 40px;
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 { font-size: 1.4em; }

    .nav-container {
        flex-direction: column;
        gap: 8px;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .ads-grid {
        grid-template-columns: 1fr;
    }

    .filter-row {
        flex-direction: column;
    }

    .filter-row input,
    .filter-row select {
        min-width: 100%;
    }

    .pending-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .moderation-actions {
        flex-direction: column;
    }

    .message-form {
        flex-direction: column;
    }
}
