@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

:root {
    --primary-color: #4f46e5;
    --primary-color-dark: #4338ca;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    
    --bg-color: #f1f5f9;
    --surface-color: #ffffff;
    --text-color: #0f172a;
    --text-muted-color: #64748b;
    --border-color: #e2e8f0;

    --font-family: 'Roboto', sans-serif;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --border-radius: 0.5rem;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 16px;
}

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

.auth-form-wrapper {
    background-color: var(--surface-color);
    padding: 2.5rem 3rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 450px;
    opacity: 0; /* For GSAP */
}

.auth-form-wrapper h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 2rem;
}

.input-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-muted-color);
    font-size: 0.9rem;
}

.input-group input,
.input-group textarea,
.input-group select {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
    font-family: var(--font-family);
    transition: border-color 0.3s, box-shadow 0.3s;
    background-color: #f8fafc;
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: #fff;
    padding: 0.9rem 1.5rem;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    background-color: var(--primary-color-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-block {
    width: 100%;
}

.btn-secondary {
    background-color: var(--secondary-color);
}
.btn-secondary:hover {
    background-color: #475569;
}

.btn-logout {
    background-color: var(--error-color);
}
.btn-logout:hover {
    background-color: #dc2626;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1.5rem;
    text-align: center;
    border: 1px solid transparent;
}
.alert.error {
    color: #b91c1c;
    background-color: #fee2e2;
    border-color: #fca5a5;
}
.alert.success {
    color: #065f46;
    background-color: #d1fae5;
    border-color: #6ee7b7;
}

.form-link {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}
.form-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}
.form-link a:hover {
    text-decoration: underline;
}


/* Dashboard Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--surface-color);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    transform: translateX(-100%); /* For GSAP */
    position: relative; /* Ensure z-index works */
    z-index: 10; /* Bring sidebar above main content */
}

.sidebar-header {
    margin-bottom: 2.5rem;
    text-align: center;
}
.sidebar-header h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 700;
}
.sidebar-header span {
    font-size: 0.9rem;
    color: var(--text-muted-color);
}

.main-content {
    flex: 1;
    padding: 2rem 3rem;
    overflow-y: auto;
}

.page-header {
    margin-bottom: 2rem;
    opacity: 0; /* For GSAP */
}
.page-header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.page-header p {
    color: var(--text-muted-color);
    font-size: 1rem;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: 1.5rem 2rem;
    border-left: 5px solid;
    opacity: 0;
    transform: translateY(30px);
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-card h4 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted-color);
}

.stat-card p {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1;
    margin-top: 0.5rem;
}

.stat-card.open { border-color: var(--success-color); }
.stat-card.in-progress { border-color: var(--primary-color); }
.stat-card.closed { border-color: var(--secondary-color); }

.content-grid {
    display: grid;
    gap: 2rem;
}

.staff-dashboard-grid {
    grid-template-columns: 1fr;
}
@media (min-width: 1024px) {
    .staff-dashboard-grid {
        grid-template-columns: 350px 1fr;
    }
}

.card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    opacity: 0; /* For GSAP */
    transform: translateY(30px); /* For GSAP */
}
.card-header h2 {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

/* Ticket List / Cards */
.ticket-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.ticket-card {
    position: relative; /* For notification positioning */
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 220px;
    opacity: 0; /* For GSAP */
    transform: scale(0.9); /* For GSAP */
}
.ticket-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.ticket-card-header h3 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}
.ticket-card-header p {
    font-size: 0.875rem;
    color: var(--text-muted-color);
    margin-bottom: 1rem;
}
.ticket-card-body {
    margin: 1rem 0;
}
.ticket-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}
.ticket-card-footer .btn {
    width: 100%;
}

.notification-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--error-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: var(--shadow-md);
    animation: pulse 1.5s infinite;
}
.notification-icon svg {
    width: 16px;
    height: 16px;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.status {
    padding: 0.3rem 0.8rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.status-open { background-color: #d1fae5; color: #065f46; }
.status-in_progress { background-color: #dbeafe; color: #1e40af; }
.status-closed { background-color: #e5e7eb; color: #374151; }


/* View Ticket Page */
.view-ticket-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
}
@media (min-width: 1200px) {
    .view-ticket-grid {
        grid-template-columns: 1fr 1.5fr;
    }
}
.ticket-info p { margin-bottom: 0.75rem; }
.ticket-info p strong { color: var(--text-color); font-weight: 500; min-width: 120px; display: inline-block; }
.ticket-info hr { margin: 1.5rem 0; border: 0; border-top: 1px solid var(--border-color); }
.admin-actions { margin-top: 1.5rem; }
.admin-actions h3 { font-size: 1.2rem; margin-bottom: 1rem; }

/* Chat System */
.chat-box {
    height: 500px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: var(--border-radius);
    background-color: var(--bg-color);
    scroll-behavior: smooth;
}
.chat-message {
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    border-radius: var(--border-radius);
    max-width: 85%;
    opacity: 0; /* For GSAP */
}
.chat-message p { margin: 0; line-height: 1.5; }
.message-meta { font-size: 0.8rem; color: var(--text-muted-color); margin-bottom: 0.3rem; }
.message-meta strong { color: var(--text-color); }
.message-meta span { float: right; }

.staff-message {
    background-color: var(--primary-color);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 0;
}
.staff-message .message-meta, .staff-message .message-meta strong { color: rgba(255,255,255,0.8); }

.admin-message {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 0;
}
.chat-form textarea {
    resize: none;
    margin-bottom: 0.5rem;
}
.chat-form .btn {
    width: 100%;
}
@media (min-width: 768px) {
    .chat-form {
        display: flex;
        gap: 0.5rem;
    }
    .chat-form textarea {
        flex: 1;
        margin-bottom: 0;
    }
    .chat-form .btn {
        width: auto;
    }
}

.mt-auto {
    margin-top: auto;
}

/* Sidebar Navigation */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 2rem;
}
.nav-item {
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    text-decoration: none;
    color: var(--text-muted-color);
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
    position: relative;
}
.nav-item:hover, .nav-item.active {
    background-color: #f1f5f9;
    color: var(--primary-color);
}
.notification-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--error-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.notifications-dropdown {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    z-index: 1000;
    width: 320px;
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}
.nav-item.notifications:hover .notifications-dropdown {
    display: block;
}
.notifications-dropdown .dropdown-header {
    padding: 1rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
}
.notifications-dropdown ul {
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
}
.notifications-dropdown ul li a {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-muted-color);
    border-bottom: 1px solid var(--border-color);
}
.notifications-dropdown ul li a:hover {
    background-color: #f1f5f9;
    color: var(--primary-color);
}
.notifications-dropdown ul li:last-child a {
    border-bottom: none;
}
.notifications-dropdown .subject {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
}
.notifications-dropdown .count {
    font-size: 0.8rem;
    color: var(--success-color);
    font-weight: 700;
}
