/* ============================================================
   AUTH & TICKET SYSTEM STYLES
   Dark theme: #0d1117 / #161b22 / #2ea043
   ============================================================ */

/* ── Auth Pages ──────────────────────────────────────────── */
.auth-page {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: #0d1117;
}

.auth-page-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
}

.auth-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 16px;
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    direction: rtl;
}

.auth-logo {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo img {
    max-height: 48px;
    width: auto;
}

.auth-title {
    font-size: 1.4rem;
    color: #e6edf3;
    text-align: center;
    margin: 0 0 24px;
    font-weight: 700;
}

/* ── Form Elements ───────────────────────────────────────── */
.auth-form .form-group {
    margin-bottom: 18px;
}

.auth-form label {
    display: block;
    color: #e6edf3;
    font-size: 0.9rem;
    margin-bottom: 6px;
    font-weight: 500;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="search"],
.auth-form textarea,
.auth-form select,
.support-form input[type="text"],
.support-form textarea,
.support-form select {
    width: 100%;
    padding: 11px 14px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #e6edf3;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.925rem;
    direction: rtl;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.auth-form input:focus,
.auth-form textarea:focus,
.auth-form select:focus,
.support-form input:focus,
.support-form textarea:focus,
.support-form select:focus {
    outline: none;
    border-color: #2ea043;
    box-shadow: 0 0 0 3px rgba(46, 160, 67, 0.12);
}

.auth-form textarea,
.support-form textarea {
    resize: vertical;
    min-height: 120px;
}

.auth-form select,
.support-form select {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 36px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* Password wrapper */
.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-left: 44px;
}

.toggle-password {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #8b949e;
    padding: 0;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.toggle-password:hover {
    color: #e6edf3;
}

/* Password strength bar */
.password-strength {
    height: 3px;
    background: #30363d;
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0;
    transition: width 0.3s, background-color 0.3s;
    border-radius: 2px;
}

/* Username status */
.username-status {
    font-size: 0.8rem;
    margin-top: 5px;
    min-height: 18px;
    transition: color 0.2s;
}

.username-status.checking { color: #8b949e; }
.username-status.available { color: #2ea043; }
.username-status.taken { color: #f85149; }

/* Submit button */
.btn-auth-submit {
    width: 100%;
    padding: 13px;
    background: #2ea043;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    margin-top: 8px;
}

.btn-auth-submit:hover {
    background: #3fb950;
}

.btn-auth-submit:active {
    transform: scale(0.98);
}

.btn-auth-submit:disabled {
    background: #30363d;
    color: #8b949e;
    cursor: not-allowed;
}

/* Auth links */
.auth-links {
    text-align: center;
    margin-top: 20px;
    color: #8b949e;
    font-size: 0.875rem;
}

.auth-links a {
    color: #2ea043;
    text-decoration: none;
    font-weight: 500;
    margin-right: 4px;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Alert messages */
.auth-error,
.auth-success {
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 16px;
    direction: rtl;
}

.auth-error {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    color: #f85149;
}

.auth-success {
    background: rgba(46, 160, 67, 0.1);
    border: 1px solid rgba(46, 160, 67, 0.3);
    color: #3fb950;
}

/* ── Header Auth UI ──────────────────────────────────────── */
.header-auth {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.header-auth-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-header-login {
    padding: 7px 16px;
    color: #e6edf3;
    border: 1px solid #30363d;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.875rem;
    transition: border-color 0.2s, color 0.2s;
}

.btn-header-login:hover {
    border-color: #2ea043;
    color: #2ea043;
}

.btn-header-register {
    padding: 7px 16px;
    background: #2ea043;
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-header-register:hover {
    background: #3fb950;
}

/* User dropdown */
.header-user-menu {
    position: relative;
}

.header-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 6px 12px;
    color: #e6edf3;
    cursor: pointer;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.875rem;
    transition: border-color 0.2s;
    direction: rtl;
}

.header-user-btn:hover {
    border-color: #2ea043;
}

.header-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2ea043;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.header-username {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chevron-icon {
    transition: transform 0.2s;
    flex-shrink: 0;
}

.header-user-btn[aria-expanded="true"] .chevron-icon {
    transform: rotate(180deg);
}

.header-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 10px;
    min-width: 180px;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
    direction: rtl;
}

.header-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: #e6edf3;
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.15s;
}

.dropdown-item:first-child {
    border-radius: 10px 10px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 10px 10px;
}

.dropdown-item:hover {
    background: rgba(48, 54, 61, 0.6);
    color: #e6edf3;
}

.dropdown-divider {
    height: 1px;
    background: #30363d;
    margin: 4px 0;
}

.dropdown-item-danger {
    color: #f85149;
}

.dropdown-item-danger:hover {
    background: rgba(248, 81, 73, 0.1);
    color: #f85149;
}

/* ── Dashboard ───────────────────────────────────────────── */
.dashboard-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px;
    direction: rtl;
}

.dashboard-header {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
}

.user-avatar-large {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #2ea043;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    flex-shrink: 0;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #2ea043;
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    color: #8b949e;
    font-size: 0.875rem;
}

/* Tabs */
.dashboard-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #30363d;
    margin-bottom: 20px;
}

.dashboard-tab-btn {
    padding: 10px 18px;
    background: none;
    border: none;
    color: #8b949e;
    cursor: pointer;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.9rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.2s, border-color 0.2s;
}

.dashboard-tab-btn:hover {
    color: #e6edf3;
}

.dashboard-tab-btn.active {
    color: #2ea043;
    border-bottom-color: #2ea043;
    font-weight: 600;
}

.dashboard-tab-content {
    display: none;
}

.dashboard-tab-content.active {
    display: block;
}

/* Tickets table */
.tickets-table {
    width: 100%;
    border-collapse: collapse;
    direction: rtl;
}

.tickets-table th,
.tickets-table td {
    padding: 12px 16px;
    text-align: right;
    border-bottom: 1px solid #30363d;
    font-size: 0.875rem;
    color: #e6edf3;
}

.tickets-table th {
    color: #8b949e;
    font-weight: 500;
    background: #0d1117;
    font-size: 0.825rem;
}

.tickets-table tbody tr:hover {
    background: rgba(48,54,61,0.3);
}

.tickets-table tbody tr:last-child td {
    border-bottom: none;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

/* Status classes (PHP generates: status-open, status-progress, etc.) */
.badge-open, .status-open         { background: rgba(88,166,255,0.15); color: #58a6ff; }
.badge-progress, .status-progress { background: rgba(210,153,34,0.15);  color: #e3b341; }
.badge-waiting, .status-waiting   { background: rgba(139,148,158,0.15); color: #8b949e; }
.badge-resolved, .status-resolved { background: rgba(46,160,67,0.15);   color: #2ea043; }
.badge-closed, .status-closed     { background: rgba(48,54,61,0.4);     color: #8b949e; }
/* Priority classes (PHP generates: priority-low, priority-medium, etc.) */
.badge-low, .priority-low         { background: rgba(46,160,67,0.15);   color: #3fb950; }
.badge-medium, .priority-medium   { background: rgba(210,153,34,0.15);  color: #e3b341; }
.badge-high, .priority-high       { background: rgba(248,81,73,0.15);   color: #f85149; }
.badge-urgent, .priority-urgent   { background: rgba(248,81,73,0.3);    color: #ff7b72; }

/* ── Ticket Conversation ─────────────────────────────────── */
.ticket-conversation {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    min-height: 80px;
}

.message-bubble {
    max-width: 75%;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #e6edf3;
}

.message-user {
    background: rgba(46, 160, 67, 0.12);
    border: 1px solid rgba(46, 160, 67, 0.25);
    border-radius: 12px 12px 4px 12px;
}

.message-admin {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px 12px 12px 4px;
}

.message-meta {
    font-size: 0.75rem;
    color: #8b949e;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Support Form Card ───────────────────────────────────── */
.support-form-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 28px;
}

.support-form-title {
    margin: 0 0 24px;
    font-size: 1.1rem;
    color: #e6edf3;
    border-right: 3px solid #2ea043;
    padding-right: 12px;
}

.support-form .form-group {
    margin-bottom: 18px;
}

.support-form label {
    display: block;
    color: #e6edf3;
    font-size: 0.9rem;
    margin-bottom: 6px;
    font-weight: 500;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .auth-card {
        padding: 28px 20px;
    }

    .dashboard-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .dashboard-header {
        flex-direction: row-reverse;
    }

    .tickets-table th:nth-child(3),
    .tickets-table td:nth-child(3),
    .tickets-table th:nth-child(4),
    .tickets-table td:nth-child(4) {
        display: none;
    }

    .message-bubble {
        max-width: 90%;
    }

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

@media (max-width: 480px) {
    .header-username {
        display: none;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .dashboard-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
