/* GACS Dashboard Custom Styles */

:root {
    /* Modern Professional Color Palette */
    --primary-color: #4F46E5;        /* Indigo - Modern & Professional */
    --primary-dark: #3730A3;         /* Darker Indigo */
    --primary-light: #6366F1;        /* Lighter Indigo */

    --secondary-color: #64748B;      /* Slate Gray */
    --success-color: #10B981;        /* Emerald Green */
    --danger-color: #EF4444;         /* Red */
    --warning-color: #F59E0B;        /* Amber */
    --info-color: #3B82F6;           /* Blue */

    --dark-color: #1E293B;           /* Dark Slate */
    --darker-color: #0F172A;         /* Darker Slate */
    --light-color: #F8FAFC;          /* Very Light Gray */
    --gray-100: #F1F5F9;             /* Light Gray */
    --gray-200: #E2E8F0;             /* Medium Light Gray */
    --gray-300: #CBD5E1;             /* Medium Gray */

    --sidebar-bg: #1E293B;           /* Dark Professional Sidebar */
    --sidebar-hover: #334155;        /* Sidebar Hover */
    --topbar-bg: #FFFFFF;            /* Clean White Topbar */

    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-100);
    min-height: 100vh;
    height: 100%;
    margin: 0;
    padding: 0;
    zoom: 80%;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100%;
    min-height: 100vh;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: white;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.08);
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width) !important;
}

.sidebar-header {
    padding: 1.5rem 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.sidebar-toggle {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 1.2rem;
    z-index: 1001;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.sidebar.collapsed .sidebar-toggle {
    left: 15px;
}

.sidebar.collapsed .sidebar-header {
    padding: 1rem 0.5rem;
}

.sidebar.collapsed .sidebar-header i {
    font-size: 1.8rem !important;
    margin-bottom: 0 !important;
}

.sidebar-header h3 {
    margin: 0;
    font-weight: 600;
    font-size: 1.1rem;
    word-wrap: break-word;
    white-space: nowrap;
    overflow: hidden;
    transition: all 0.3s ease;
}

.sidebar.collapsed .sidebar-header h3 {
    opacity: 0;
    height: 0;
    font-size: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    margin: 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.3s;
    background: transparent;
    position: relative;
}

.sidebar.collapsed .sidebar-menu a {
    padding: 1rem 0;
    justify-content: center;
}

.sidebar-menu a:hover {
    background: var(--sidebar-hover);
    color: white;
}

.sidebar-menu a.active {
    background: var(--sidebar-hover);
    color: white;
    border-left: 4px solid var(--primary-color);
    padding-left: calc(1.25rem - 4px);
}

.sidebar.collapsed .sidebar-menu a:hover,
.sidebar.collapsed .sidebar-menu a.active {
    padding-left: 0;
    border-left: none;
    border-bottom: 3px solid var(--primary-color);
}

.sidebar-menu i {
    margin-right: 0.75rem;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.sidebar.collapsed .sidebar-menu i {
    margin-right: 0;
    font-size: 1.3rem;
}

.sidebar-menu span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.3s ease;
}

.sidebar.collapsed .sidebar-menu span {
    opacity: 0;
    width: 0;
    display: none;
}

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .sidebar-menu a {
    position: relative;
}

.sidebar.collapsed .sidebar-menu a::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--darker-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-left: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1002;
}

.sidebar.collapsed .sidebar-menu a:hover::after {
    opacity: 1;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--light-color);
    transition: margin-left 0.3s ease;
}

.main-content.collapsed {
    margin-left: var(--sidebar-collapsed-width) !important;
}

.topbar {
    background: var(--topbar-bg);
    padding: 1rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-200);
}

.topbar h4 {
    margin: 0;
    color: var(--dark-color);
}

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

.content-wrapper {
    padding: 2rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    background: white;
    color: var(--dark-color);
    padding: 1rem 1.5rem;
    font-weight: 600;
    border-bottom: 1px solid var(--gray-200);
}

.card-body {
    padding: 1.5rem;
}

/* Stats Cards */
.stats-grid {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: nowrap;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--gray-200);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    flex: 1 1 0;
    min-width: 0;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
    border-color: var(--gray-300);
}

.stat-card.primary {
    border-top: 3px solid var(--primary-color);
}

.stat-card.success {
    border-top: 3px solid var(--success-color);
}

.stat-card.danger {
    border-top: 3px solid var(--danger-color);
}

.stat-card.warning {
    border-top: 3px solid var(--warning-color);
}

.stat-icon {
    font-size: 2rem;
    opacity: 0.3;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.stat-info {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.stat-info h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-info p {
    margin: 0.25rem 0 0 0;
    color: var(--secondary-color);
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: var(--gray-100);
}

table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

table td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    color: var(--secondary-color);
}

table tbody tr:hover {
    background: var(--gray-100);
}

/* Badges */
.badge {
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge.online {
    background: #D1FAE5;
    color: #065F46;
}

.badge.offline {
    background: #FEE2E2;
    color: #991B1B;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

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

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 3rem;
    width: 100%;
    max-width: 450px;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h2 {
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--secondary-color);
}

/* Footer */
.footer {
    background: white;
    padding: 1.5rem;
    text-align: center;
    color: var(--secondary-color);
    margin-top: 2rem;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.footer a:hover {
    text-decoration: underline;
}

/* Map Styles */
#map {
    height: 600px;
    border-radius: 10px;
    overflow: hidden;
}

/* Alert Styles */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid;
    font-size: 0.9375rem;
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
    border-color: #10B981;
}

.alert-danger {
    background: #FEE2E2;
    color: #991B1B;
    border-color: #EF4444;
}

.alert-warning {
    background: #FEF3C7;
    color: #92400E;
    border-color: #F59E0B;
}

.alert-info {
    background: #DBEAFE;
    color: #1E40AF;
    border-color: #3B82F6;
}

/* Loading Spinner */
.spinner {
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Inline spin animation for icons */
.spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* Modal Styles */
.modal-content {
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.modal-header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 1.25rem 1.5rem;
    border-radius: 12px 12px 0 0;
}

.modal-header .modal-title {
    color: var(--dark-color);
    font-weight: 600;
    font-size: 1.125rem;
}

.modal-header .modal-title i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    background: var(--gray-100);
    border-top: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
    border-radius: 0 0 12px 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .stats-grid {
        flex-wrap: wrap;
    }

    .stat-card {
        flex: 1 1 calc(50% - 0.25rem);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        flex-wrap: wrap;
    }

    .stat-card {
        flex: 1 1 100%;
    }
}
