/**
 * Custom CSS for SAMPARK - Railway Complaint System
 */

:root {
    /* Apple-inspired color palette */
    --apple-black: #000000;
    --apple-dark-gray: #666666;
    --apple-medium-gray: #979797;
    --apple-light-gray: #eeeeee;
    --apple-blue: #0088cc;
    
    /* Gradient colors */
    --gradient-start: hsla(330, 100%, 99%, 1); /* #FFFBFD */
    --gradient-end: hsla(0, 0%, 88%, 1); /* #E1E1E1 */
    
    /* Legacy railway colors for backward compatibility */
    --railway-blue: #0088cc;
    --railway-orange: #ea580c;
    --railway-green: #16a34a;
    --railway-red: #dc2626;
    --railway-yellow: #eab308;
    --light-gray: var(--apple-light-gray);
    --medium-gray: var(--apple-medium-gray);
    --dark-gray: var(--apple-dark-gray);
}

/* General Styles - Apple-inspired */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.47059;
    color: var(--apple-black);
    background: var(--gradient-start);
    background: linear-gradient(90deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    background: -moz-linear-gradient(90deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    background: -webkit-linear-gradient(90deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#FFFBFD", endColorstr="#E1E1E1", GradientType=1);
    min-height: 100vh;
    font-weight: 400;
    letter-spacing: -0.022em;
}
.main-content {
    margin: 5px;
    padding: 5px;
}
/* Apple-inspired Card Enhancements */
.card {
    border: none;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
}

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

.card-header {
    background: linear-gradient(69deg, #b6e7ff, #2f6b93);
    color: white;
    font-weight: 600;
    font-size: 17px;
    letter-spacing: -0.022em;
    border-radius: 18px 18px 0 0 !important;
    padding: 20px 24px;
    border-bottom: none;
}

/* Apple-inspired Status Badges */
.status-pending {
    background-color: #FF9500;
    color: white;
    border-radius: 12px;
    font-weight: 600;
    font-size: 12px;
    padding: 6px 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.status-replied {
    background-color: var(--apple-blue);
    color: white;
    border-radius: 12px;
    font-weight: 600;
    font-size: 12px;
    padding: 6px 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.status-replied {
    background-color: #30D158;
    color: white;
    border-radius: 12px;
    font-weight: 600;
    font-size: 12px;
    padding: 6px 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.status-closed {
    background-color: var(--apple-dark-gray);
    color: white;
    border-radius: 12px;
    font-weight: 600;
    font-size: 12px;
    padding: 6px 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.status-reverted {
    background-color: #FF3B30;
    color: white;
    border-radius: 12px;
    font-weight: 600;
    font-size: 12px;
    padding: 6px 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.status-awaiting-approval {
    background-color: #FF9500;
    color: white;
    border-radius: 12px;
    font-weight: 600;
    font-size: 12px;
    padding: 6px 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Priority Badges - Auto-escalating System */
.priority-normal {
    background-color: #22c55e;
    color: white;
}

.priority-medium {
    background-color: var(--railway-yellow);
    color: #000;
}

.priority-high {
    background-color: var(--railway-orange);
    color: white;
}

.priority-critical {
    background-color: var(--railway-red);
    color: white;
    animation: pulse 2s infinite;
}

/* Critical priority pulse animation */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Legacy support for old 'low' priority */
.priority-low {
    background-color: #22c55e;
    color: white;
}

/* Apple-inspired Form Enhancements */
.form-control,
.form-select {
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    padding: 12px 16px;
    font-size: 17px;
    line-height: 1.47059;
    letter-spacing: -0.022em;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 4px rgba(0, 136, 204, 0.15);
    background: rgba(255, 255, 255, 0.95);
    outline: none;
}

.btn-railway-primary,
.btn-primary {
    background: var(--apple-blue);
    border: none;
    color: white;
    font-weight: 600;
    font-size: 17px;
    letter-spacing: -0.022em;
    border-radius: 12px;
    padding: 12px 24px;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    min-height: 44px;
}

.btn-railway-primary:hover,
.btn-primary:hover {
    background: #007acc;
    box-shadow: 0 8px 24px rgba(0, 136, 204, 0.3);
    color: white;
}

.btn-railway-secondary,
.btn-secondary {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--apple-black);
    font-weight: 600;
    font-size: 17px;
    letter-spacing: -0.022em;
    border-radius: 12px;
    padding: 12px 24px;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    min-height: 44px;
}

.btn-railway-secondary:hover,
.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.2);
    color: var(--apple-black);
}

/* Apple-inspired Dashboard Cards */
.dashboard-card {
    border: none;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.dashboard-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.1);
}

.dashboard-card.card-complaints::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #FF9500;
}

.dashboard-card.card-pending::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #FF9500;
}

.dashboard-card.card-replied::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #30D158;
}

.dashboard-card.card-users::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--apple-blue);
}

.dashboard-card.card-awaiting-approval::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #FF9500;
}

.dashboard-card {
    position: relative;
}

.dashboard-card .card-body {
    padding: 24px;
}

.dashboard-card .display-4 {
    font-weight: 700;
    color: var(--apple-black);
    font-size: 2.5rem;
    letter-spacing: -0.022em;
}

/* Table Enhancements */
.table {
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table thead th {
    background: var(--railway-blue);
    color: white;
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.table tbody tr:hover {
    background-color: var(--light-gray);
}

/* File Upload Area */
.file-upload-area {
    border: 2px dashed var(--medium-gray);
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    transition: border-color 0.3s;
    background: var(--light-gray);
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: var(--railway-blue);
    background: #e0f2fe;
}

.file-upload-area i {
    font-size: 3rem;
    color: var(--dark-gray);
    margin-bottom: 1rem;
}

/* Timeline Styles */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--medium-gray);
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
    background: white;
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.75rem;
    top: 1rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--railway-blue);
    border: 3px solid white;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--medium-gray);
    border-top-color: var(--railway-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error and Success Messages */
/* Apple-inspired Alert Messages */
.alert {
    border: none;
    border-radius: 18px;
    font-weight: 600;
    font-size: 17px;
    letter-spacing: -0.022em;
    padding: 20px 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.alert-success {
    background: rgba(48, 209, 88, 0.1);
    color: #1e7e34;
    border: 1px solid rgba(48, 209, 88, 0.2);
}

.alert-danger {
    background: rgba(255, 59, 48, 0.1);
    color: #721c24;
    border: 1px solid rgba(255, 59, 48, 0.2);
}

.alert-warning {
    background: rgba(255, 149, 0, 0.1);
    color: #8b5000;
    border: 1px solid rgba(255, 149, 0, 0.2);
}

.alert-info {
    background: rgba(0, 136, 204, 0.1);
    color: #004080;
    border: 1px solid rgba(0, 136, 204, 0.2);
}

/* Rating Stars */
.rating {
    display: flex;
    gap: 0.25rem;
}

.rating .star {
    font-size: 1.25rem;
    color: var(--medium-gray);
    cursor: pointer;
    transition: color 0.2s;
}

.rating .star:hover,
.rating .star.active {
    color: #fbbf24;
}

/* Search and Filter Bar */
.search-filter-bar {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar-brand span {
        font-size: 1rem;
    }
    
    .dashboard-card .display-4 {
        font-size: 2rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .timeline {
        padding-left: 1rem;
    }
    
    .timeline-item::before {
        left: -1.25rem;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .footer,
    .btn,
    .alert {
        display: none !important;
    }
    
    .main-content {
        margin-top: 0 !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* Accessibility Improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicators */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--railway-blue);
    outline-offset: 2px;
}

/* Apple-inspired Typography */
h1, .h1 {
    font-size: 3rem;
    font-weight: 700;
    color: var(--apple-black);
    letter-spacing: -0.022em;
    line-height: 1.05;
}

h2, .h2 {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--apple-black);
    letter-spacing: -0.022em;
    line-height: 1.1;
}

h3, .h3 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--apple-black);
    letter-spacing: -0.022em;
    line-height: 1.2;
}

h4, .h4 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--apple-black);
    letter-spacing: -0.022em;
    line-height: 1.3;
}

h5, .h5 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--apple-black);
    letter-spacing: -0.022em;
    line-height: 1.4;
}

h6, .h6 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--apple-black);
    letter-spacing: -0.022em;
    line-height: 1.5;
}

p, .text-body {
    font-size: 17px;
    line-height: 1.47059;
    letter-spacing: -0.022em;
    color: var(--apple-black);
}

.text-small {
    font-size: 15px;
    line-height: 1.33337;
    letter-spacing: -0.016em;
}

.text-large {
    font-size: 21px;
    line-height: 1.38095;
    letter-spacing: -0.021em;
}

/* Profile Page Enhancements */
.profile-header {
    background: linear-gradient(135deg, var(--railway-blue) 0%, #0066aa 100%);
    border-radius: 20px;
    padding: 2rem;
    color: white;
    margin-bottom: 2rem;
}

.profile-card {
    transition: all 0.3s ease;
    border-radius: 18px;
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.profile-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.profile-card .card-header {
    border-radius: 18px 18px 0 0 !important;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.profile-badge {
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-weight: 500;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
}

.profile-info-row {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.profile-info-row:last-child {
    border-bottom: none;
}

.profile-info-label {
    font-weight: 600;
    color: var(--apple-dark-gray);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.profile-info-value {
    color: var(--apple-black);
    font-size: 1rem;
    margin-bottom: 0;
    font-weight: 400;
}

.profile-quick-actions .btn {
    border-radius: 12px;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    letter-spacing: -0.01em;
    transition: all 0.2s ease;
}

.profile-quick-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.profile-alert {
    border-radius: 12px;
    border: none;
    padding: 1rem;
    font-weight: 500;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid #000;
    }
    
    .btn-railway-primary {
        background: #000;
        border: 2px solid #000;
    }
    
    .profile-card {
        border: 2px solid #000;
    }
}

/* Apple-inspired Enhanced Responsive Design */
@media (max-width: 768px) {
    h1, .h1 {
        font-size: 2.5rem;
    }
    
    h2, .h2 {
        font-size: 2rem;
    }
    
    .dashboard-card .display-4 {
        font-size: 2rem;
    }
    
    .table-responsive {
        font-size: 15px;
    }
    
    .timeline {
        padding-left: 1rem;
    }
    
    .timeline-item::before {
        left: -1.25rem;
    }
    
    .card {
        border-radius: 16px;
    }
    
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

@media (max-width: 480px) {
    h1, .h1 {
        font-size: 2rem;
    }
    
    h2, .h2 {
        font-size: 1.75rem;
    }
    
    .card {
        border-radius: 14px;
    }
    
    .btn-railway-primary,
    .btn-primary {
        padding: 14px 20px;
        font-size: 16px;
    }
}

/* Global Alert Styles for Auto-dismiss */
.alert {
    border: none;
    border-radius: 0.75rem;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.alert i {
    margin-right: 0.5rem;
    font-weight: 600;
}

.alert .btn-close {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.alert .btn-close:hover {
    opacity: 1;
}

/* Alert animation for auto-dismiss */
.alert.fade {
    transition: opacity 0.3s ease;
}

.alert.fade.show {
    opacity: 1;
}

.alert.fade:not(.show) {
    opacity: 0;
}

/* Alert auto-dismiss animation */
@keyframes slideInFromTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutToTop {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}

.alert.alert-slide-in {
    animation: slideInFromTop 0.3s ease-out;
}

.alert.alert-slide-out {
    animation: slideOutToTop 0.3s ease-in;
}

/* Ensure alerts are visible and properly styled */
.alert-dismissible {
    padding-right: 3rem;
}

.alert-dismissible .btn-close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    padding: 0.75rem 1rem;
}

/* Add logout-specific styles */
.logout-link {
    transition: all 0.3s ease;
}

.logout-link:hover {
    background-color: #dc3545 !important;
    color: white !important;
}

/* Ensure notifications are cleared smoothly during logout */
.alert-slide-out {
    animation: slideOut 0.3s ease-out forwards;
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateY(0);
        max-height: 100px;
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
        max-height: 0;
        margin: 0;
        padding: 0;
    }
}

/* Loading state for logout */
.logout-loading {
    pointer-events: none;
    opacity: 0.7;
}

/* Ensure all notifications are properly cleared */
.alert-container:empty {
    display: none;
}

/* Smooth transition for notification clearing */
.alert {
    transition: all 0.3s ease;
}

/* Hide notifications when user is not logged in */
body:not(.logged-in) .alert-container {
    display: none;
}
