/* GSM Portal - Custom CSS */

:root {
    --bs-primary: #0d6efd;
    --gsm-bg: #f8f9fa;
}

/* Dark theme variables */
[data-bs-theme="dark"] {
    --gsm-bg: #1a1d21;
}

body {
    background-color: var(--gsm-bg);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Navbar brand */
.navbar-brand {
    font-size: 1.25rem;
    letter-spacing: -0.5px;
}

/* Cards */
.card {
    border-radius: 0.5rem;
}

.card-header {
    border-radius: 0.5rem 0.5rem 0 0 !important;
}

/* Stat cards hover effect */
.card.hover-shadow:hover {
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.15) !important;
    transition: box-shadow 0.2s ease;
}

/* Context Menu */
.context-menu {
    position: absolute;
    z-index: 1080;
    background: #fff;
    border-radius: 0.375rem;
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.2);
    min-width: 220px;
    border: 1px solid rgba(0,0,0,.1);
}

.context-menu-header {
    padding: .5rem 1rem;
    font-size: .875rem;
    color: #6c757d;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
    border-radius: 0.375rem 0.375rem 0 0;
}

.context-menu-item {
    padding: .5rem 1rem;
    cursor: pointer;
    font-size: .9rem;
    color: #212529;
    transition: background-color 0.15s;
}

.context-menu-item:hover {
    background-color: #e9ecef;
}

.context-menu-item i {
    margin-right: .5rem;
    color: #0d6efd;
}

.context-menu-danger {
    color: #dc3545;
}

.context-menu-danger:hover {
    background-color: #f8d7da;
}

.context-menu-danger i {
    color: #dc3545;
}

.context-menu-divider {
    height: 1px;
    background: #dee2e6;
    margin: 0;
}

/* DataTables styling */
table.dataTable thead th {
    border-bottom: 2px solid #dee2e6;
}

table.dataTable tbody td {
    vertical-align: middle;
}

/* Envanter tablosu - 1 punto küçültülmüş */
#linesTable {
    font-size: calc(100% - 1pt);
}

/* Badge colors for statuses */
.badge {
    font-weight: 500;
    font-size: 0.75em;
}

/* Footer */
footer {
    font-size: 0.875rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }

    .navbar-brand {
        font-size: 1rem;
    }
}

/* SweetAlert2 z-index fix */
.swal2-container {
    z-index: 9999 !important;
}

/* Select2 width fix */
.select2-container {
    width: 100% !important;
}

/* Pool badge in navbar */
.pool-badge {
    font-size: 0.65rem;
    vertical-align: top;
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Prominent search bar */
.search-card .search-input-group {
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.search-card .search-input-group:focus-within {
    box-shadow: 0 0.0 0.375rem 0.15rem rgba(13, 110, 253, 0.25);
}

.search-card .input-group-text {
    border: 2px solid #0d6efd;
    border-right: none;
    min-width: 52px;
    justify-content: center;
}

.search-card .form-control {
    border: 2px solid #dee2e6;
    border-left: none;
    border-right: 2px solid #dee2e6;
    font-size: 1.05rem;
    padding: 0.7rem 1rem;
    transition: border-color 0.2s ease;
}

.search-card .form-control:focus {
    border-color: #0d6efd;
    border-left: none;
    border-right: 2px solid #0d6efd;
    box-shadow: none;
}

.search-card .btn-clear {
    border: 2px solid #dee2e6;
    border-left: none;
    background-color: #f8f9fa;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.search-card .btn-clear:hover {
    background-color: #f1f3f5;
    border-color: #adb5bd;
    color: #dc3545;
}

.search-card kbd {
    font-size: 0.75rem;
    padding: 0.1rem 0.35rem;
    background-color: #e9ecef;
    color: #495057;
}

/* ============================================================
   Reminder (Hatırlatıcı) Styles
   ============================================================ */

/* Row with any reminder */
.has-reminder-row {
    background-color: rgba(13, 110, 253, 0.04);
}

/* Row with due reminder (vadesi gelmiş) */
.reminder-due-row {
    background-color: rgba(255, 193, 7, 0.10) !important;
    border-left: 3px solid #ffc107;
}

.reminder-due-row td:first-child {
    border-left: none;
}

/* Bell icon in inventory table */
.reminder-bell {
    font-size: 0.85rem;
    vertical-align: middle;
    margin-left: 0.25rem;
    cursor: help;
    animation: bell-pulse 2s ease-in-out infinite;
}

@keyframes bell-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Dashboard reminder note cell */
.reminder-note-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Dashboard İş Programı card */
#reminderTable .badge {
    min-width: 110px;
}

/* ============================================================
   Theme Toggle Button
   ============================================================ */
.theme-toggle-btn {
    border: none;
    cursor: pointer;
    font-size: 1.15rem;
    padding: 0.4rem 0.6rem;
    color: rgba(255, 255, 255, 0.85);
    transition: color 0.2s;
    display: flex;
    align-items: center;
}

.theme-toggle-btn:hover {
    color: #fff;
}

/* Light theme: show moon icon, hide sun */
[data-bs-theme="light"] .theme-icon-dark { display: none; }
[data-bs-theme="light"] .theme-icon-light { display: inline; }

/* Dark theme: show sun icon, hide moon */
[data-bs-theme="dark"] .theme-icon-light { display: none; }
[data-bs-theme="dark"] .theme-icon-dark { display: inline; }

/* ============================================================
   Dark Theme Overrides
   ============================================================ */

/* Context menu */
[data-bs-theme="dark"] .context-menu {
    background: #2b3035;
    border-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .context-menu-header {
    background: #23272b;
    border-bottom-color: rgba(255, 255, 255, 0.1);
    color: #adb5bd;
}

[data-bs-theme="dark"] .context-menu-item {
    color: #dee2e6;
}

[data-bs-theme="dark"] .context-menu-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .context-menu-item i {
    color: #6ea8fe;
}

[data-bs-theme="dark"] .context-menu-danger i {
    color: #ea868f;
}

[data-bs-theme="dark"] .context-menu-danger:hover {
    background-color: rgba(220, 53, 69, 0.15);
}

[data-bs-theme="dark"] .context-menu-divider {
    background: rgba(255, 255, 255, 0.1);
}

/* Cards */
[data-bs-theme="dark"] .card {
    background-color: #212529;
    border-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .card-header {
    background-color: #212529;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* Search bar */
[data-bs-theme="dark"] .search-card {
    background-color: #212529 !important;
}

[data-bs-theme="dark"] .search-card .form-control {
    background-color: #2b3035;
    border-color: #495057;
    color: #dee2e6;
}

[data-bs-theme="dark"] .search-card .form-control:focus {
    background-color: #2b3035;
    border-color: #6ea8fe;
    color: #dee2e6;
}

[data-bs-theme="dark"] .search-card .input-group-text {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

[data-bs-theme="dark"] .search-card .btn-clear {
    background-color: #2b3035;
    border-color: #495057;
    color: #adb5bd;
}

[data-bs-theme="dark"] .search-card .btn-clear:hover {
    background-color: #343a40;
    color: #ea868f;
}

/* Tables */
[data-bs-theme="dark"] table.dataTable thead th {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* Reminder rows in dark mode */
[data-bs-theme="dark"] .has-reminder-row {
    background-color: rgba(110, 168, 254, 0.06) !important;
}

[data-bs-theme="dark"] .reminder-due-row {
    background-color: rgba(255, 193, 7, 0.10) !important;
    border-left-color: #ffc107;
}

/* SweetAlert2 dark mode */
[data-bs-theme="dark"] .swal2-popup {
    background: #212529;
    color: #dee2e6;
}

/* Select2 dark mode */
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection {
    background-color: #2b3035;
    border-color: #495057;
    color: #dee2e6;
}

[data-bs-theme="dark"] .select2-dropdown {
    background-color: #2b3035;
    border-color: #495057;
}

[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-results__option {
    color: #dee2e6;
}

[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-results__option--highlighted {
    background-color: #0d6efd;
    color: #fff;
}

/* Modals dark mode */
[data-bs-theme="dark"] .modal-content {
    background-color: #212529;
}

[data-bs-theme="dark"] .modal-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .modal-footer {
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* Form controls */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: #2b3035;
    border-color: #495057;
    color: #dee2e6;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: #2b3035;
    border-color: #6ea8fe;
    color: #dee2e6;
}

/* Dropdown menus */
[data-bs-theme="dark"] .dropdown-menu {
    background-color: #2b3035;
    border-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .dropdown-item {
    color: #dee2e6;
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: rgba(255, 255, 255, 0.08);
    color: #fff;
}

[data-bs-theme="dark"] .dropdown-divider {
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* Badges visibility in dark mode */
[data-bs-theme="dark"] .badge.bg-light {
    background-color: #495057 !important;
    color: #dee2e6 !important;
}

[data-bs-theme="dark"] .badge.bg-secondary {
    background-color: #6c757d !important;
}

/* Alert dark mode */
[data-bs-theme="dark"] .alert {
    border-color: rgba(255, 255, 255, 0.1);
}

/* Table light (thead) dark mode */
[data-bs-theme="dark"] .table-light {
    --bs-table-bg: #2b3035;
    --bs-table-color: #dee2e6;
    background-color: #2b3035;
    color: #dee2e6;
}

[data-bs-theme="dark"] .table-light th {
    background-color: #2b3035;
    color: #dee2e6;
    border-color: rgba(255, 255, 255, 0.1);
}

/* bg-white override in dark mode */
[data-bs-theme="dark"] .bg-white {
    background-color: #212529 !important;
}

/* List group dark mode */
[data-bs-theme="dark"] .list-group-item {
    background-color: transparent;
    border-color: rgba(255, 255, 255, 0.1);
    color: #dee2e6;
}

[data-bs-theme="dark"] .list-group-item-action:hover,
[data-bs-theme="dark"] .list-group-item-action:focus {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

/* kbd dark mode */
[data-bs-theme="dark"] kbd {
    background-color: #495057;
    color: #dee2e6;
}

/* Search card clear button kbd */
[data-bs-theme="dark"] .search-card kbd {
    background-color: #495057;
    color: #dee2e6;
}

/* Form text / text-muted improvements */
[data-bs-theme="dark"] .form-text {
    color: #adb5bd;
}

/* Input group text */
[data-bs-theme="dark"] .input-group-text {
    background-color: #2b3035;
    border-color: #495057;
    color: #dee2e6;
}

/* Table bordered dark mode */
[data-bs-theme="dark"] .table-bordered {
    border-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .table-bordered th,
[data-bs-theme="dark"] .table-bordered td {
    border-color: rgba(255, 255, 255, 0.1);
}

/* Card text-dark override */
[data-bs-theme="dark"] .text-dark {
    color: #dee2e6 !important;
}

/* Footer dark mode */
[data-bs-theme="dark"] footer {
    border-color: rgba(255, 255, 255, 0.1);
}

/* ============================================================
   Login Page Animated Background
   ============================================================ */

body.auth-page {
    margin: 0;
    overflow: hidden;
    background-color: transparent;
}

html:has(body.auth-page) {
    height: 100%;
}

body.auth-page .bg-layer {
    animation: slide 3s ease-in-out infinite alternate;
    background-image: linear-gradient(-60deg, #6c3 50%, #09f 50%);
    bottom: 0;
    left: -50%;
    opacity: .5;
    position: fixed;
    right: -50%;
    top: 0;
    z-index: -1;
}

body.auth-page .bg-layer.bg2 {
    animation-direction: alternate-reverse;
    animation-duration: 4s;
}

body.auth-page .bg-layer.bg3 {
    animation-duration: 5s;
}

body.auth-page .auth-card {
    background-color: rgba(255, 255, 255, .85);
    border-radius: .5rem;
    box-shadow: 0 0 .5rem rgba(0, 0, 0, .25);
    backdrop-filter: blur(4px);
}

@keyframes slide {
    0% {
        transform: translateX(-25%);
    }
    100% {
        transform: translateX(25%);
    }
}
