@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap');

:root {
    --primary: #0f4c81;
    --primary-light: #1a6db5;
    --primary-dark: #0a3358;
    --secondary: #ff9f1c;
    --secondary-light: #ffbf69;
    --accent: #2ec4b6;
    --accent-light: #5be3d6;
    --bg: #f0f4f8;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #eef2f7;
    --text: #0f172a;
    --text-2: #475569;
    --text-3: #94a3b8;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 2px 0 rgb(15 23 42 / 0.05);
    --shadow: 0 4px 6px -1px rgb(15 23 42 / 0.08), 0 2px 4px -2px rgb(15 23 42 / 0.08);
    --shadow-lg: 0 10px 15px -3px rgb(15 23 42 / 0.1), 0 4px 6px -4px rgb(15 23 42 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(15 23 42 / 0.12), 0 8px 10px -6px rgb(15 23 42 / 0.12);
    --radius-sm: 8px;
    --radius: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --glass: rgba(255, 255, 255, 0.85);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--bg);
    color: var(--text);
    direction: rtl;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 10% 20%, rgba(15, 76, 129, 0.08) 0%, transparent 25%),
        radial-gradient(circle at 90% 80%, rgba(46, 196, 182, 0.08) 0%, transparent 25%),
        radial-gradient(circle at 50% 50%, rgba(255, 159, 28, 0.05) 0%, transparent 30%);
    z-index: -1;
    animation: gradientMove 20s ease-in-out infinite;
}

@keyframes gradientMove {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(20px, -20px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.login-container::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    opacity: 0.1;
    filter: blur(80px);
    top: -200px;
    right: -200px;
    animation: float 8s ease-in-out infinite;
}

.login-container::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    opacity: 0.1;
    filter: blur(80px);
    bottom: -150px;
    left: -150px;
    animation: float 10s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-30px) rotate(5deg); }
}

.login-box {
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 48px 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 440px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.login-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--secondary));
}

.brand-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
    box-shadow: var(--shadow-lg);
    animation: pulse 2s ease-in-out infinite;
}

.brand-logo {
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    animation: pulse 2s ease-in-out infinite;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 10px 25px rgba(15, 76, 129, 0.3); }
    50% { transform: scale(1.05); box-shadow: 0 15px 35px rgba(15, 76, 129, 0.4); }
}

.login-box h1 {
    text-align: center;
    margin-bottom: 8px;
    color: var(--primary-dark);
    font-size: 28px;
    font-weight: 800;
}

.login-subtitle {
    text-align: center;
    color: var(--text-2);
    margin-bottom: 32px;
    font-size: 15px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--text);
    font-size: 14px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    font-size: 18px;
    transition: var(--transition);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--surface-3);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--surface);
    color: var(--text);
}

.form-group input.has-icon,
.form-group select.has-icon {
    padding: 14px 16px 14px 48px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(15, 76, 129, 0.1);
    background: var(--surface);
}

.form-group input:focus + .input-icon,
.form-group input:not(:placeholder-shown) + .input-icon {
    color: var(--primary);
}

.form-group input::placeholder {
    color: var(--text-3);
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-login,
.btn-enter,
.btn-danger,
.navbar .logout {
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    box-shadow: 0 4px 12px rgba(15, 76, 129, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 76, 129, 0.35);
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--surface);
    color: var(--primary);
    border: 2px solid var(--surface-3);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--surface-2);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.35);
}

.btn-login {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    font-size: 17px;
    font-weight: 800;
    border-radius: var(--radius-sm);
    box-shadow: 0 6px 20px rgba(15, 76, 129, 0.3);
    margin-top: 8px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(15, 76, 129, 0.4);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 12px;
    border-radius: 10px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 12px;
}

/* Dashboard */
.dashboard {
    min-height: 100vh;
}

.navbar {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar h2 {
    color: white;
    font-size: 20px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-logo img {
    width: 46px;
    height: 46px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: transparent;
    padding: 0;
    box-shadow: none;
    border: none;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.navbar .logout,
.navbar .btn-secondary {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.navbar .logout:hover,
.navbar .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.main-content {
    padding: 28px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.page-header {
    margin-bottom: 28px;
}

.page-header h2 {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 6px;
}

.page-header p {
    color: var(--text-2);
    font-size: 15px;
}

/* Cards */
.card {
    background: var(--surface);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.card-header h3 {
    color: var(--primary-dark);
    font-size: 18px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h3 .icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.card-header h3 .icon.blue { background: rgba(15, 76, 129, 0.1); color: var(--primary); }
.card-header h3 .icon.orange { background: rgba(255, 159, 28, 0.1); color: var(--secondary); }
.card-header h3 .icon.green { background: rgba(34, 197, 94, 0.1); color: var(--success); }
.card-header h3 .icon.red { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.card-header h3 .icon.purple { background: rgba(168, 85, 247, 0.1); color: #a855f7; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--surface);
    padding: 22px 18px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(226, 232, 240, 0.8);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.stat-card.blue::before { background: var(--primary); }
.stat-card.orange::before { background: var(--secondary); }
.stat-card.green::before { background: var(--success); }
.stat-card.purple::before { background: #a855f7; }
.stat-card.red::before { background: var(--danger); }

.stat-card h4 {
    font-size: 32px;
    margin-bottom: 6px;
    color: var(--text);
    font-weight: 800;
}

.stat-card p {
    font-size: 14px;
    color: var(--text-2);
    font-weight: 600;
}

.stat-icon {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    opacity: 0.15;
}

/* Building Cards */
.buildings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 8px;
}

.building-card {
    background: var(--surface);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.building-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.building-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.building-card h4 {
    color: var(--primary-dark);
    font-size: 20px;
    margin-bottom: 10px;
    font-weight: 800;
}

.building-card p {
    color: var(--text-2);
    font-size: 14px;
    margin-bottom: 8px;
    line-height: 1.6;
}

.building-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0;
    font-size: 13px;
}

.building-card-meta .badge {
    background: rgba(15, 76, 129, 0.08);
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 12px;
}

.building-card-actions {
    display: flex;
    justify-content: flex-end;
}

.btn-enter {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(15, 76, 129, 0.25);
}

.btn-enter:hover {
    transform: translateX(-4px);
    box-shadow: 0 8px 20px rgba(15, 76, 129, 0.35);
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--surface-3);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 600px;
}

th, td {
    padding: 14px 16px;
    text-align: right;
    font-size: 14px;
    border-bottom: 1px solid var(--surface-3);
}

th {
    background: var(--surface-2);
    font-weight: 800;
    color: var(--primary-dark);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    position: sticky;
    top: 0;
}

th:first-child { border-radius: 0 var(--radius-sm) 0 0; }
th:last-child { border-radius: var(--radius-sm) 0 0 0; }

tr:last-child td:first-child { border-radius: 0 0 var(--radius-sm) 0; }
tr:last-child td:last-child { border-radius: 0 0 0 var(--radius-sm); }

tr:hover td {
    background: var(--surface-2);
}

.user-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    transition: var(--transition);
}

.user-link:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.badge-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

/* Forms in cards */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-row .form-group {
    margin-bottom: 0;
}

.form-row .form-group input,
.form-row .form-group select {
    padding: 12px 14px;
}

.multi-select-row {
    grid-template-columns: repeat(3, 1fr);
}

.multi-select {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.multi-select-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.multi-select-item select {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--surface-3);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
}

/* Section cards */
.section-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.section-header {
    background: linear-gradient(135deg, var(--surface-2), var(--surface));
    padding: 18px 24px;
    border-bottom: 1px solid var(--surface-3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h3 {
    color: var(--primary-dark);
    font-size: 17px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-body {
    padding: 24px;
}

/* Change password */
.change-password-form {
    background: var(--surface-2);
    padding: 24px;
    border-radius: var(--radius-sm);
}

/* Report pages */
.report-container {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.report-header {
    background: linear-gradient(135deg, var(--surface-2), var(--surface));
    padding: 28px;
    border-bottom: 1px solid var(--surface-3);
}

.report-header h3 {
    font-size: 24px;
    color: var(--primary-dark);
    margin-bottom: 10px;
    font-weight: 800;
}

.report-header p {
    color: var(--text-2);
    font-size: 15px;
    margin-bottom: 4px;
}

.report-body {
    padding: 28px;
}

.report-notes {
    background: var(--surface-2);
    padding: 22px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    line-height: 1.9;
    white-space: pre-wrap;
    border-right: 4px solid var(--primary);
    color: var(--text);
    font-size: 15px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.media-item {
    width: 100%;
    border-radius: var(--radius-sm);
    background: var(--primary-dark);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.media-item:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

.media-item img,
.media-item video,
.media-item audio {
    width: 100%;
    display: block;
    border-radius: var(--radius-sm);
}

/* Comments */
.comments-section {
    padding: 28px;
    background: var(--surface-2);
    border-top: 1px solid var(--surface-3);
}

.comments-section h4 {
    margin-bottom: 22px;
    color: var(--primary-dark);
    font-size: 18px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comment {
    padding: 18px;
    border-radius: var(--radius);
    max-width: 85%;
    position: relative;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.comment-client {
    background: white;
    border-right: 4px solid #3b82f6;
    align-self: flex-start;
    border-radius: var(--radius) var(--radius) var(--radius) 4px;
}

.comment-engineer {
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    border-left: 4px solid var(--secondary);
    align-self: flex-end;
    border-radius: var(--radius) var(--radius) 4px var(--radius);
}

.comment-admin {
    background: linear-gradient(135deg, #faf5ff, #f3e8ff);
    border-right: 4px solid #a855f7;
    align-self: flex-start;
    border-radius: var(--radius) var(--radius) var(--radius) 4px;
}

.comment-contractor {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border-left: 4px solid var(--success);
    align-self: flex-end;
    border-radius: var(--radius) var(--radius) 4px var(--radius);
}

.comment-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.comment-author {
    font-weight: 800;
    color: var(--text);
    font-size: 14px;
}

.comment-role {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-2);
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 700;
}

.comment-time {
    font-size: 12px;
    color: var(--text-3);
    margin-right: auto;
    font-weight: 500;
}

.comment p {
    line-height: 1.8;
    color: var(--text);
    font-size: 15px;
}

.add-comment {
    margin-top: 24px;
    padding: 22px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.add-comment textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--surface-3);
    border-radius: var(--radius-sm);
    font-size: 15px;
    resize: vertical;
    min-height: 100px;
    background: var(--surface);
    font-family: inherit;
    transition: var(--transition);
}

.add-comment textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(15, 76, 129, 0.1);
}

.add-comment .btn-primary {
    align-self: flex-end;
    min-width: 140px;
}

.comment-media-controls,
.media-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.audio-recorder {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
}

.audio-recorder #recordTimer {
    font-weight: 800;
    color: var(--danger);
    font-family: monospace;
    font-size: 16px;
}

.comment-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.comment-media-grid .media-item {
    border-radius: 10px;
}

.deleted-item {
    opacity: 0.6;
}

.deleted-row {
    opacity: 0.6;
    background: rgba(239, 68, 68, 0.05);
}

.deleted-content {
    color: var(--text-muted);
}

.deleted-time {
    color: var(--danger) !important;
}

.audit-log {
    margin-top: 24px;
    padding: 16px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.audit-log h4 {
    margin-bottom: 12px;
    color: var(--text);
}

.audit-item {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.audit-item:last-child {
    border-bottom: none;
}

.audit-time {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 8px;
}

.audit-author {
    font-size: 12px;
    color: var(--primary);
}

/* Report form */
.report-form-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.report-form-header {
    background: linear-gradient(135deg, var(--surface-2), var(--surface));
    padding: 24px;
    border-bottom: 1px solid var(--surface-3);
}

.report-form-header h3 {
    font-size: 22px;
    color: var(--primary-dark);
    margin-bottom: 6px;
    font-weight: 800;
}

.report-form-header p {
    color: var(--text-2);
    font-size: 14px;
}

.report-form-body {
    padding: 28px;
}

.media-buttons {
    margin-bottom: 10px;
}

.media-buttons .btn-secondary {
    border-style: dashed;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
    border: 1px solid var(--surface-3);
    animation: slideIn 0.25s ease-out;
}

.file-type {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.success-message {
    color: var(--success);
    font-weight: 700;
    padding: 12px;
    background: rgba(34, 197, 94, 0.1);
    border-radius: var(--radius-sm);
    margin-top: 12px;
}

.error {
    color: var(--danger);
    font-weight: 700;
}

/* Reports list */
.reports-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.report-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.report-item:hover {
    background: white;
    border-color: var(--primary);
    transform: translateX(-4px);
    box-shadow: var(--shadow);
}

.report-item.active {
    background: rgba(15, 76, 129, 0.08);
    border-color: var(--primary);
}

.report-date {
    font-weight: 800;
    color: var(--primary);
    font-size: 15px;
}

.report-title {
    color: var(--text-2);
    font-size: 13px;
}

.empty {
    color: var(--text-3);
    text-align: center;
    padding: 40px 20px;
    font-size: 15px;
}

/* Building details */
.building-hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 32px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.building-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.building-hero h3 {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 10px;
    position: relative;
}

.building-hero p {
    opacity: 0.9;
    font-size: 15px;
    position: relative;
}

.filters {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 20px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
}

.filters .form-group {
    margin-bottom: 0;
    min-width: 160px;
}

.filters .form-group label {
    font-size: 13px;
}

.filters .form-group input {
    padding: 10px 14px;
}

.date-input-wrapper {
    position: relative;
    display: inline-block;
    min-width: 160px;
}

.date-input-wrapper input[type="date"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.date-input-wrapper .date-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 14px;
    border: 2px solid var(--surface-3);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-3);
    font-size: 15px;
    min-height: 46px;
    direction: rtl;
}

.date-input-wrapper.has-value .date-display {
    color: var(--text);
}

.date-input-wrapper .date-display .calendar-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    opacity: 0.8;
    filter: invert(25%) sepia(80%) saturate(800%) hue-rotate(180deg);
}

.date-input-wrapper:hover .date-display,
.date-input-wrapper input[type="date"]:focus + .date-display {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(15, 76, 129, 0.1);
}

input[type="date"] {
    position: relative;
    padding: 12px 14px 12px 42px;
    border: 2px solid var(--surface-3);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    background: var(--surface);
    color: var(--text);
    min-width: 160px;
    min-height: 46px;
    text-align: right;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 28px;
    height: 28px;
    margin: auto 0;
    cursor: pointer;
    opacity: 0.9;
    filter: invert(25%) sepia(80%) saturate(800%) hue-rotate(180deg);
    background-size: contain;
}

input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(15, 76, 129, 0.1);
}

.date-search {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.date-search input[type="date"] {
    padding: 10px 14px;
    border: 2px solid var(--surface-3);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
}

.navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin: 20px 0;
}

.current-date {
    font-weight: 800;
    color: var(--primary);
    font-size: 16px;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.stat-card.loading h4 {
    background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    color: transparent;
    border-radius: var(--radius-sm);
    min-width: 40px;
    display: inline-block;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .login-box {
        padding: 32px 24px;
    }

    .login-box h1 {
        font-size: 24px;
    }

    .navbar {
        padding: 14px 16px;
    }

    .navbar h2 {
        font-size: 16px;
    }

    .navbar-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .main-content {
        padding: 16px;
    }

    .card {
        padding: 18px;
        border-radius: var(--radius-sm);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 18px 14px;
    }

    .stat-card h4 {
        font-size: 26px;
    }

    .stat-card p {
        font-size: 12px;
    }

    .buildings-grid {
        grid-template-columns: 1fr;
    }

    .building-card {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .multi-select-row {
        grid-template-columns: 1fr;
    }

    .report-header,
    .report-body,
    .comments-section,
    .report-form-body,
    .report-form-header {
        padding: 20px;
    }

    .comment {
        max-width: 95%;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filters .form-group {
        min-width: auto;
    }

    .navigation {
        flex-direction: column;
    }

    .navigation button {
        width: 100%;
    }

    .media-grid {
        grid-template-columns: 1fr;
    }

    th, td {
        padding: 12px;
        font-size: 13px;
    }

    table {
        min-width: 600px;
    }

    .table-wrapper {
        margin: 0 -8px;
        border-radius: 0;
    }
}

@media (min-width: 769px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* Print styles */
@media print {
    .navbar,
    .add-comment,
    .comment-media-controls,
    .btn-primary,
    .btn-secondary {
        display: none !important;
    }

    .report-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 24px;
    left: 24px;
    background: var(--surface);
    color: var(--text);
    padding: 16px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    border-right: 4px solid var(--success);
    z-index: 1000;
    animation: toastIn 0.3s ease-out;
    font-weight: 700;
}

.toast.error {
    border-right-color: var(--danger);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 420px;
    padding: 24px;
    animation: modalIn 0.25s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
