/* =====================================================
   PRIMANOR HELPDESK - STYLES
   Based on Primanor main website design
   ===================================================== */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #00b4b4;
    --primary-dark: #009999;
    --primary-light: #33cccc;
    --secondary-color: #64748b;
    --accent-color: #00b4b4;
    --text-dark: #ffffff;
    --text-light: #cbd5e1;
    --bg-dark: #0a0a0a;
    --bg-darker: #000000;
    --bg-light: #1a1a1a;
    --bg-card: #1f1f1f;
    --border-color: #2a2a2a;

    /* Status colors */
    --status-open: #3b82f6;
    --status-progress: #f59e0b;
    --status-waiting: #8b5cf6;
    --status-resolved: #10b981;
    --status-closed: #6b7280;

    /* Priority colors */
    --priority-low: #6b7280;
    --priority-medium: #3b82f6;
    --priority-high: #f59e0b;
    --priority-critical: #ef4444;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 180, 180, 0.2);
    --shadow-cyan: 0 0 20px rgba(0, 180, 180, 0.3);
    --transition: all 0.3s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-darker);
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Admin page wider container */
.admin-page .container {
    max-width: 1600px;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo a {
    display: flex;
    align-items: center;
}

.logo-img {
    height: 40px;
    width: auto;
    transition: var(--transition);
}

.logo-img:hover {
    filter: drop-shadow(0 0 10px rgba(0, 180, 180, 0.5));
}

.logo-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
}

.logo-text {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.1rem;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Main Content */
.main-content {
    padding-top: 100px;
    padding-bottom: 3rem;
    min-height: 100vh;
}

.page-header {
    text-align: center;
    margin-bottom: 3rem;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 30px rgba(0, 180, 180, 0.4);
}

.page-header p {
    color: var(--text-light);
    font-size: 1.1rem;
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 968px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    color: var(--text-dark);
}

.card-header h2 svg {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--bg-darker);
    box-shadow: var(--shadow-cyan);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 180, 180, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--bg-darker);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

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

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-full {
    width: 100%;
}

/* Forms */
.ticket-form {
    padding: 1.5rem;
}

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

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

@media (max-width: 500px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-light);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group .form-hint {
    display: block;
    margin-top: 0.35rem;
    color: var(--text-light);
    font-size: 0.8rem;
    opacity: 0.8;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.875rem;
    background: var(--bg-dark);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-dark);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-light);
    opacity: 0.6;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 180, 180, 0.15);
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 18px;
    padding-right: 2.5rem;
}

.form-group select option {
    background: var(--bg-dark);
    color: var(--text-dark);
}

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

/* Ticket Filter */
.ticket-filter {
    display: flex;
    gap: 0.5rem;
}

.ticket-filter input {
    padding: 0.5rem 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-dark);
    font-size: 0.9rem;
    width: 200px;
}

.ticket-filter input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Tickets List */
.tickets-list {
    padding: 1rem;
    max-height: 500px;
    overflow-y: auto;
}

.ticket-item {
    padding: 1rem;
    background: var(--bg-dark);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.ticket-item:hover {
    border-color: var(--primary-color);
    transform: translateX(5px);
    box-shadow: var(--shadow-cyan);
}

.ticket-item:last-child {
    margin-bottom: 0;
}

.ticket-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.ticket-item-title {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.ticket-item-id {
    color: var(--text-light);
    font-size: 0.8rem;
}

.ticket-item-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ticket-item-date {
    color: var(--text-light);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* Status & Priority Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Status badges */
.badge-open {
    background: rgba(59, 130, 246, 0.15);
    color: var(--status-open);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-in_progress {
    background: rgba(245, 158, 11, 0.15);
    color: var(--status-progress);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-waiting {
    background: rgba(139, 92, 246, 0.15);
    color: var(--status-waiting);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.badge-waiting_user {
    background: rgba(236, 72, 153, 0.15);
    color: #ec4899;
    border: 1px solid rgba(236, 72, 153, 0.3);
}

.badge-resolved {
    background: rgba(16, 185, 129, 0.15);
    color: var(--status-resolved);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-closed {
    background: rgba(107, 114, 128, 0.15);
    color: var(--status-closed);
    border: 1px solid rgba(107, 114, 128, 0.3);
}

/* Priority badges */
.badge-low {
    background: rgba(107, 114, 128, 0.15);
    color: var(--priority-low);
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.badge-medium {
    background: rgba(59, 130, 246, 0.15);
    color: var(--priority-medium);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-high {
    background: rgba(245, 158, 11, 0.15);
    color: var(--priority-high);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-critical {
    background: rgba(239, 68, 68, 0.15);
    color: var(--priority-critical);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Category badges */
.badge-category {
    background: rgba(0, 180, 180, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(0, 180, 180, 0.3);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.95rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    padding: 1rem;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-large {
    max-width: 900px;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.25rem;
    color: var(--text-dark);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--primary-color);
    background: rgba(0, 180, 180, 0.1);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Ticket Detail */
.ticket-detail-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .ticket-detail-grid {
        grid-template-columns: 1fr;
    }

    /* Ticket detail info - single column on mobile */
    .ticket-detail-info {
        grid-template-columns: 1fr;
    }

    /* Status and priority actions - stack vertically on mobile */
    .status-actions,
    .priority-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .status-select,
    .priority-select {
        width: 100%;
    }

    /* Comment options - better mobile layout */
    .comment-options {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .comment-options .checkbox-label {
        width: 100%;
    }

    .comment-options .file-upload-btn,
    .comment-options button {
        width: 100%;
        justify-content: center;
    }
}

.ticket-main h4 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.ticket-detail-header {
    margin-bottom: 1rem;
}

.ticket-detail-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.ticket-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ticket-detail-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-dark);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.ticket-detail-info-item {
    font-size: 0.9rem;
}

.ticket-detail-info-item label {
    display: block;
    color: var(--text-light);
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.ticket-detail-description {
    background: var(--bg-dark);
    padding: 1rem;
    border-radius: 8px;
    color: var(--text-light);
    line-height: 1.7;
    white-space: pre-wrap;
}

/* Ticket Sidebar */
.ticket-sidebar {
    background: var(--bg-dark);
    border-radius: 12px;
    padding: 1.25rem;
}

.ticket-sidebar h4 {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
    margin-top: 0;
}

.ticket-sidebar h4:not(:first-child) {
    margin-top: 1.5rem;
}

.status-actions,
.priority-actions {
    display: flex;
    gap: 0.5rem;
}

.status-select,
.priority-select {
    flex: 1;
    padding: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-dark);
    font-size: 0.9rem;
}

/* Ticket description - limit height */
.ticket-description-content {
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Ticket sidebar - make scrollable if needed */
.ticket-sidebar {
    max-height: calc(80vh - 200px);
    overflow-y: auto;
}

.danger-zone {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(239, 68, 68, 0.3);
}

.danger-zone h4 {
    color: #ef4444;
}

/* Time Tracking Section */
.time-tracking-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.time-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.time-input-group label {
    min-width: 70px;
    font-size: 0.875rem;
    color: var(--text-light);
}

.time-input {
    flex: 1;
    padding: 0.5rem;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-dark);
    font-size: 0.875rem;
}

.time-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 180, 180, 0.2);
}

.time-spent-display {
    text-align: center;
    color: var(--text-light);
}

.time-spent-display strong {
    color: var(--text-dark);
}

/* Reports Section */
.reports-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 8px;
}

.reports-filters .filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 150px;
}

.reports-filters label {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 500;
}

.reports-filters .filter-input,
.reports-filters .filter-select {
    padding: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-dark);
    font-size: 0.875rem;
}

.reports-filters .filter-input:focus,
.reports-filters .filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 180, 180, 0.2);
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.summary-card h3 {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.summary-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
}

.report-results {
    margin-top: 1.5rem;
}

/* Comments */
.comments-section {
    margin-top: 1.5rem;
}

.comments-list {
    max-height: 300px;
    overflow-y: auto;
}

.comment-item {
    padding: 1rem;
    background: var(--bg-dark);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    border-left: 3px solid var(--primary-color);
}

.comment-item.internal {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

.comment-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.comment-actions .btn-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 4px;
    opacity: 0.6;
    transition: var(--transition);
}

.comment-actions .btn-icon:hover {
    opacity: 1;
}

.comment-actions .btn-edit-comment:hover {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.comment-actions .btn-delete-comment:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.comment-author {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.comment-date {
    font-size: 0.8rem;
    color: var(--text-light);
}

.comment-badge {
    font-size: 0.7rem;
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

.comment-text {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.6;
}

.comment-form textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-dark);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 80px;
    margin-bottom: 0.75rem;
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.comment-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

/* Admin Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 968px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-card.clickable {
    cursor: pointer;
}

.stat-card.clickable:hover {
    border-color: var(--primary);
}

.stat-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.3);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 28px;
    height: 28px;
}

.stat-icon.open {
    background: rgba(59, 130, 246, 0.15);
    color: var(--status-open);
}

.stat-icon.progress {
    background: rgba(245, 158, 11, 0.15);
    color: var(--status-progress);
}

.stat-icon.waiting {
    background: rgba(139, 92, 246, 0.15);
    color: var(--status-waiting);
}

.stat-icon.resolved {
    background: rgba(16, 185, 129, 0.15);
    color: var(--status-resolved);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1;
}

.stat-label {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Filters Bar */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    color: var(--text-light);
    font-size: 0.9rem;
    white-space: nowrap;
}

.filter-group select,
.filter-group input {
    padding: 0.5rem 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-group {
    flex: 1;
    min-width: 200px;
}

.search-group input {
    width: 100%;
}

/* Tickets Table */
.tickets-table-card {
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
}

.tickets-table {
    width: 100%;
    min-width: 1200px;
    border-collapse: collapse;
    table-layout: auto;
}

.tickets-table th,
.tickets-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.tickets-table th {
    background: var(--bg-dark);
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tickets-table tbody tr {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.tickets-table tbody tr:hover {
    background: rgba(0, 180, 180, 0.1);
}

.tickets-table td {
    font-size: 0.9rem;
}

.table-title {
    font-weight: 500;
    color: var(--text-dark);
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-email {
    color: var(--text-light);
    font-size: 0.85rem;
}

.table-date {
    color: var(--text-light);
    font-size: 0.85rem;
    white-space: nowrap;
}

.table-actions {
    display: flex;
    gap: 0.5rem;
    white-space: nowrap;
}

/* Tegevuste veerg fikseeritud laius */
.tickets-table th:last-child,
.tickets-table td:last-child {
    width: 120px;
    min-width: 120px;
    text-align: center;
}

/* ID veerg kompaktsem */
.tickets-table th:first-child,
.tickets-table td:first-child {
    width: 100px;
    white-space: nowrap;
}

/* Pealkiri veerg pikem */
.tickets-table th:nth-child(2),
.tickets-table td:nth-child(2) {
    min-width: 200px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(0, 180, 180, 0.1);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

/* Notification Toast */
.notification {
    position: fixed;
    top: 100px;
    right: -500px;
    z-index: 3000;
    transition: right 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 400px;
    width: 90%;
}

.notification.show {
    right: 20px;
}

.notification-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.notification.error .notification-content {
    border-left-color: #ef4444;
}

.notification-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 180, 180, 0.1);
    border-radius: 8px;
    color: var(--primary-color);
}

.notification.error .notification-icon {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.notification-icon svg {
    width: 20px;
    height: 20px;
}

.notification-text {
    flex: 1;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.notification-close {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.25rem;
}

.notification-close:hover {
    color: var(--text-dark);
}

.notification-close svg {
    width: 18px;
    height: 18px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
    .page-header h1 {
        font-size: 2rem;
    }

    .modal-content {
        margin: 0.5rem;
        max-height: 95vh;
    }

    .ticket-filter {
        flex-direction: column;
        width: 100%;
    }

    .ticket-filter input {
        width: 100%;
    }

    .filters-bar {
        flex-direction: column;
        gap: 0.75rem;
    }

    .filter-group {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .filter-group label {
        font-size: 0.85rem;
    }

    .filter-group select,
    .filter-group input {
        width: 100%;
        padding: 0.75rem; /* Touch-friendly padding */
        min-height: 44px; /* Touch-friendly minimum */
    }

    .search-group {
        min-width: auto;
    }
}

/* =====================================================
   AUTH & LANGUAGE STYLES
   ===================================================== */

/* Help Link */
.nav-help-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--text-secondary);
    transition: var(--transition);
    margin-right: 0.5rem;
}

.nav-help-link:hover {
    background: var(--bg-secondary);
    color: var(--primary);
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    background: var(--bg-dark);
    border-radius: 6px;
    overflow: hidden;
    margin-right: 1rem;
}

.lang-btn {
    padding: 0.4rem 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.lang-btn:hover {
    color: var(--text-dark);
}

.lang-btn.active {
    background: var(--primary-color);
    color: var(--bg-dark);
}

/* Auth Buttons */
.auth-buttons {
    display: flex;
    gap: 0.5rem;
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Login Prompt Card */
.login-prompt {
    max-width: 500px;
    margin: 2rem auto;
    text-align: center;
}

.login-prompt-content {
    padding: 3rem 2rem;
}

.login-prompt-content svg {
    width: 64px;
    height: 64px;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.login-prompt-content h2 {
    color: var(--text-dark);
    margin-bottom: 0.75rem;
    font-size: 1.5rem;
}

.login-prompt-content p {
    color: var(--text-light);
    margin-bottom: 2rem;
}

.login-prompt-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Auth Modals */
.modal-small {
    max-width: 400px;
}

.auth-form {
    padding: 1.5rem;
}

.auth-form .form-group {
    margin-bottom: 1.25rem;
}

.form-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: none;
}

.auth-switch {
    text-align: center;
    margin-top: 1.25rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

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

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* Guest Fields */
.guest-fields {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.guest-info {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(0, 180, 180, 0.1);
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
}

/* Tickets Login Prompt */
.tickets-login-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    color: var(--text-light);
}

.tickets-login-prompt svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.tickets-login-prompt p {
    margin-bottom: 1rem;
}

/* Responsive Auth */
@media (max-width: 600px) {
    .nav-right {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .lang-switcher {
        margin-right: 0;
    }

    .auth-buttons {
        flex-wrap: wrap;
    }

    .login-prompt-buttons {
        flex-direction: column;
    }

    .user-menu {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}

/* =====================================================
   MOBILE RESPONSIVE STYLES
   ===================================================== */
@media (max-width: 768px) {
    /* Navigation */
    .nav-wrapper {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem 0;
    }

    .logo {
        justify-content: center;
    }

    .nav-right {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
        width: 100%;
    }

    .user-menu {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
        width: 100%;
    }

    .user-menu .btn {
        width: 100%;
    }

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

    /* Header */
    .header-section {
        padding: 100px 0 30px;
    }

    .header-section h1 {
        font-size: 1.5rem;
    }

    .header-section p {
        font-size: 1rem;
    }

    /* Main content */
    .main-content {
        padding: 1rem 0;
    }

    .content-grid {
        gap: 1rem;
    }

    /* Cards */
    .card-header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .card-header h2 {
        font-size: 1.1rem;
    }

    /* Forms */
    .ticket-form {
        padding: 1rem;
    }

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

    /* Modals */
    .modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
        border-radius: 12px;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    /* Buttons - ensure touch-friendly size */
    .btn {
        padding: 0.75rem 1.25rem; /* Increased from 0.625rem 1rem */
        font-size: 0.875rem;
        min-height: 44px; /* Touch-friendly minimum */
        min-width: 44px; /* For icon buttons */
    }

    .btn-sm {
        padding: 0.5rem 1rem; /* Increased from 0.4rem 0.75rem */
        font-size: 0.8rem;
        min-height: 40px; /* Slightly smaller but still touch-friendly */
    }

    /* Tickets list */
    .ticket-card {
        padding: 1rem;
    }

    .ticket-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .ticket-card-meta {
        flex-wrap: wrap;
    }

    /* Tables - make more mobile-friendly */
    .tickets-table {
        min-width: auto; /* Remove fixed min-width on mobile */
        font-size: 0.85rem;
    }

    .tickets-table th,
    .tickets-table td {
        padding: 0.75rem 0.5rem; /* Reduced padding */
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    .container {
        padding: 0 10px;
    }

    .logo-img {
        height: 32px;
    }

    .lang-switcher .lang-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    .badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    /* Form inputs */
    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    /* Modal */
    .modal-content.modal-small,
    .modal-content.modal-medium {
        max-width: none;
        margin: 5px;
    }

    /* File upload */
    .file-upload-area {
        padding: 1rem;
    }

    .file-list-item {
        padding: 0.5rem;
    }

    .file-info-name {
        max-width: 150px;
    }

    /* Hide less important columns on mobile */
    .tickets-table th:nth-child(4),
    .tickets-table td:nth-child(4),
    .tickets-table th:nth-child(5),
    .tickets-table td:nth-child(5) {
        display: none; /* Hide category and priority columns */
    }
}

/* =====================================================
   ADMIN TABS & USER MANAGEMENT
   ===================================================== */

/* Admin Tabs */
.admin-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem;
    background: var(--bg-dark);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: rgba(0, 180, 180, 0.1);
    color: var(--primary-color);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
}

.tab-btn svg {
    opacity: 0.8;
}

.tab-btn.active svg {
    opacity: 1;
}

.tab-content {
    display: block;
}

/* Users Header */
.users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.users-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.users-header .btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Users Table Card */
.users-table-card {
    padding: 0;
    overflow: hidden;
}

/* Badge Styles */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-admin {
    background: rgba(124, 58, 237, 0.15);
    color: #7c3aed;
}

.badge-user {
    background: rgba(0, 180, 180, 0.15);
    color: var(--primary-color);
}

.badge-waiting_user {
    background: rgba(236, 72, 153, 0.15);
    color: #ec4899;
    border: 1px solid rgba(236, 72, 153, 0.3);
    white-space: nowrap;
}

/* Status badges - ensure visibility */
.badge-open,
.badge-in_progress,
.badge-waiting,
.badge-waiting_user,
.badge-resolved,
.badge-closed {
    white-space: nowrap;
    overflow: visible;
}

/* Extra small button */
.btn-xs {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* Actions Cell */
.actions-cell {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

/* Modal small body padding */
.modal-small .modal-body {
    padding: 1.5rem;
}

/* Danger Button */
.btn-danger {
    background: #ef4444;
    color: white;
}

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

/* Full width button */
.btn-full {
    width: 100%;
}

@media (max-width: 768px) {
    .admin-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }

    .tab-btn {
        justify-content: center;
        padding: 0.75rem 1rem; /* Touch-friendly */
        min-height: 44px; /* Touch-friendly minimum */
    }

    .users-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .users-header .btn {
        justify-content: center;
        width: 100%;
    }

    .actions-cell {
        flex-direction: column;
        gap: 0.5rem;
    }

    .actions-cell .btn {
        width: 100%;
        justify-content: center;
    }

    /* Stats grid - already responsive, but ensure touch-friendly */
    .stat-card {
        padding: 1rem;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
    }

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

/* =====================================================
   FILE UPLOAD STYLES
   ===================================================== */

.file-upload-wrapper {
    position: relative;
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    background: var(--bg-light);
    transition: var(--transition);
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(0, 180, 180, 0.05);
}

.file-upload-area svg {
    width: 48px;
    height: 48px;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.file-upload-area p {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.file-upload-area .file-types {
    color: var(--text-light);
    font-size: 0.85rem;
}

/* File List */
.file-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-list.small {
    margin-top: 0.5rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.file-list.small .file-item {
    padding: 0.5rem;
}

.file-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    flex-shrink: 0;
}

.file-list.small .file-icon {
    width: 28px;
    height: 28px;
}

.file-icon svg {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
}

.file-list.small .file-icon svg {
    width: 16px;
    height: 16px;
}

.file-icon.pdf { background: rgba(239, 68, 68, 0.1); }
.file-icon.pdf svg { color: #ef4444; }

.file-icon.image { background: rgba(59, 130, 246, 0.1); }
.file-icon.image svg { color: #3b82f6; }

.file-icon.doc { background: rgba(37, 99, 235, 0.1); }
.file-icon.doc svg { color: #2563eb; }

.file-icon.excel { background: rgba(16, 185, 129, 0.1); }
.file-icon.excel svg { color: #10b981; }

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 500;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
}

.file-list.small .file-name {
    font-size: 0.85rem;
}

.file-size {
    font-size: 0.8rem;
    color: var(--text-light);
}

.file-remove {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.file-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.file-remove svg {
    width: 16px;
    height: 16px;
}

/* Comment Attachments */
.comment-attachments {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.comment-attachments input[type="file"] {
    display: none;
}

.attach-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
}

.attach-btn svg {
    width: 16px;
    height: 16px;
}

.comment-attachments .file-list {
    width: 100%;
    margin-top: 0.5rem;
}

/* Attachments Section in Ticket Details */
.attachments-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.attachments-section h4 {
    color: var(--text-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.attachments-section h4 svg {
    width: 18px;
    height: 18px;
    color: var(--primary-color);
}

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

.attachment-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    text-decoration: none;
    transition: var(--transition);
}

.attachment-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.attachment-preview {
    width: 100%;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
}

.attachment-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.attachment-preview svg {
    width: 48px;
    height: 48px;
    color: var(--text-light);
}

.attachment-name {
    font-size: 0.85rem;
    color: var(--text-dark);
    text-align: center;
    word-break: break-word;
    width: 100%;
}

.attachment-size {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* Comment with attachments */
.comment-attachment-list {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.comment-attachment {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: var(--bg-light);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-dark);
    font-size: 0.85rem;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.comment-attachment:hover {
    background: var(--bg-card);
    border-color: var(--primary-color);
}

.comment-attachment svg {
    width: 14px;
    height: 14px;
    color: var(--primary-color);
}

/* Upload progress */
.upload-progress {
    margin-top: 1rem;
}

.progress-bar {
    height: 6px;
    background: var(--bg-light);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .file-upload-area {
        padding: 1.5rem;
    }

    .file-upload-area svg {
        width: 36px;
        height: 36px;
    }

    .attachments-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .comment-attachments {
        flex-direction: column;
        align-items: stretch;
    }
}
