/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette */
    --primary-color: #e8d5d5;
    /* Soft Beige/Pink */
    --primary-dark: #d0b0b0;
    --secondary-color: #f8f9fa;
    /* Light Gray Background */
    --accent-color: #bfa5a5;
    /* Darker accent */
    --text-color: #4a4a4a;
    --text-light: #888888;
    --success-color: #a7c4a0;
    /* Soft Green */
    --warning-color: #e6c8a0;
    /* Soft Orange */
    --danger-color: #e2a0a0;
    /* Soft Red */
    --info-color: #a0c4e2;
    /* Soft Blue */
    --white: #ffffff;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 70px;
    --card-radius: 20px;
    --input-radius: 12px;
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.05);

    /* Transitions */
    --transition-speed: 0.3s;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: var(--primary-dark) var(--secondary-color);
}

/* Custom Scrollbar Webkit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--secondary-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-dark);
    border-radius: 10px;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--secondary-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
    width: 100%;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    color: #2d2d2d;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

/* Utilities */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--input-radius);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-speed);
    border: none;
    font-size: 0.95rem;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--accent-color);
    color: var(--white);
    box-shadow: 0 4px 10px rgba(191, 165, 165, 0.3);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

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

.btn-outline:hover {
    background-color: var(--accent-color);
    color: var(--white);
}

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

.card {
    background: var(--white);
    border-radius: var(--card-radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

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

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

.form-control {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid #e0e0e0;
    border-radius: var(--input-radius);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color var(--transition-speed);
    background-color: #fafafa;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    background-color: var(--white);
    box-shadow: 0 0 0 3px rgba(191, 165, 165, 0.1);
}

/* Layout Classes */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--white);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(0, 0, 0, 0.03);
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: all var(--transition-speed);
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
    /* Slight rounded corners for logo if needed */
}

.nav-menu {
    flex: 1;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: var(--input-radius);
    color: var(--text-light);
    transition: all 0.2s;
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background-color: var(--primary-color);
    color: var(--text-color);
}

.nav-link i {
    width: 20px;
    text-align: center;
}

.nav-footer {
    position: relative;
    /* Allows absolute positioning of the toggle button if needed, or flex */
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Sidebar Toggle Button (Inside Sidebar) */
.sidebar-toggle-btn {
    background: var(--secondary-color);
    border: none;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-color);
    align-self: flex-end;
    /* Align right */
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    margin-top: 1rem;
}

.sidebar-toggle-btn:hover {
    background: var(--primary-color);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    transition: margin-left var(--transition-speed);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
}

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

.user-avatar {
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-color);
}

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

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

.custom-table th {
    text-align: left;
    padding: 1rem;
    color: var(--text-light);
    font-weight: 500;
    border-bottom: 1px solid #eee;
}

.custom-table td {
    padding: 1rem;
    border-bottom: 1px solid #f5f5f5;
    color: var(--text-color);
}

.custom-table tr:hover td {
    background-color: #fafafa;
}

.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-warning {
    background-color: var(--warning-color);
    color: #8a6d4b;
}

.badge-success {
    background-color: var(--success-color);
    color: #3c5438;
}

.badge-danger {
    background-color: var(--danger-color);
    color: #723b3b;
}

.badge-info {
    background-color: var(--info-color);
    color: #3b5a72;
}

.badge-bekliyor {
    background-color: var(--info-color);
    color: #3b5a72;
}

.badge-yapildi {
    background-color: var(--success-color);
    color: #3c5438;
}

.badge-iptal {
    background-color: var(--danger-color);
    color: #723b3b;
}

.badge-ertelendi {
    background-color: var(--warning-color);
    color: #8a6d4b;
}

/* Login */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 3rem;
}

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

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sidebar Collapsed State */
.sidebar.collapsed {
    width: 80px;
    padding: 2rem 0.75rem;
}

.sidebar.collapsed .sidebar-logo span,
.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar.collapsed .sidebar-logo {
    justify-content: center;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 1rem 0;
}

.sidebar.collapsed .nav-footer {
    /* align-items: center; Removed to allow full width links */
}

.sidebar.collapsed .nav-footer span {
    display: none;
}

.sidebar.collapsed .sidebar-toggle-btn {
    align-self: center;
    /* Center it when collapsed */
}

.main-content.expanded {
    margin-left: 80px;
}

/* Old Toggle Button (Header) - Hide it now */
.header .toggle-btn {
    display: none;
}

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

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    }

    .main-content {
        margin-left: 0 !important;
        padding: 1rem;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* Header Mobile Layout */
    .header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        width: 100%;
    }

    .header>div {
        width: 100%;
        justify-content: space-between;
    }

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

    /* Show Header Toggle Button */
    .header .toggle-btn {
        display: block;
        font-size: 1.5rem;
        padding: 0.5rem;
    }

    /* Grid System Overrides - Stacking Columns */
    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        width: 100%;
    }

    /* Filter Bar Mobile */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .filter-bar .filter-group {
        width: 100%;
    }

    .filter-bar input[style*="width"] {
        width: 100% !important;
    }

    .filter-bar>div:last-child {
        width: 100%;
        margin-top: 1rem;
        flex-direction: column;
    }

    .filter-bar .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    /* Tables */
    /* Tables */
    /* Changed logic: Instead of negative margins causing overflow, use simple full width */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
        padding: 0;
        border: 1px solid #f0f0f0;
        border-radius: 8px;
    }

    .custom-table {
        min-width: 600px;
        /* Ensure table has minimum width to trigger scroll */
    }

    .custom-table th,
    .custom-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    /* Card Adjustments */
    .card {
        padding: 1.25rem;
        border-radius: 12px;
        width: 100%;
        overflow: hidden;
        /* Contain children */
    }

    .custom-table th,
    .custom-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
        /* Smaller font for dense data */
        white-space: nowrap;
        /* Prevent awkward wrapping in small cells */
    }

    /* Card Adjustments */
    .card {
        padding: 1.25rem;
        /* Less padding inside cards */
        border-radius: 12px;
        /* Slightly smaller radius */
    }

    /* Wizard Steps (if any) */
    .wizard-steps {
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
}

/* NO ANIMATION FOR INITIAL STATE */
.preload-collapsed .sidebar {
    width: 80px !important;
    transition: none !important;
}

.preload-collapsed .main-content {
    margin-left: 80px !important;
    transition: none !important;
}

.preload-collapsed .sidebar-logo span,
.preload-collapsed .nav-link span {
    display: none !important;
}

.preload-collapsed .sidebar-logo {
    justify-content: center !important;
}

.preload-collapsed .nav-link {
    justify-content: center !important;
    padding: 1rem 0 !important;
}

.preload-collapsed .nav-footer span {
    display: none !important;
}



/* Segmented Radio Group (Premium Toggle) */
.radio-group-buttons {
    display: flex;
    background: #f0f0f0;
    padding: 6px;
    border-radius: 14px;
    gap: 6px;
    margin-bottom: 1.5rem;
    border: 1px solid #e0e0e0;
}

.radio-button {
    flex: 1;
    cursor: pointer;
    position: relative;
    text-align: center;
}

.radio-button input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-button span {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    color: #888;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.25s ease;
    background: transparent;
}

.radio-button.active span {
    background-color: var(--accent-color);
    color: var(--white);
    box-shadow: 0 4px 10px rgba(191, 165, 165, 0.3);
}

.radio-button:not(.active):hover span {
    background: #fff;
    color: var(--accent-color);
}


.radio-button:active span {
    transform: scale(0.96);
}


/* Custom Multi-select Dropdown (Native-like) */
.multi-select-container {
    position: relative;
    width: 100%;
}

.multi-select-header {
    background-color: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: var(--input-radius);
    padding: 0.8rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    transition: all var(--transition-speed);
    min-height: 48px;
}

.multi-select-header:hover {
    border-color: var(--accent-color);
    background-color: #fff;
}

.ms-selected-text {
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 85%;
}

.multi-select-options {
    display: none;
    position: absolute;
    top: 105%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #eee;
    border-radius: var(--input-radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
    padding: 0.3rem;
}

.multi-select-options.active {
    display: block;
    animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.multi-select-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.multi-select-option:hover {
    background: #f1f1f1;
}

.multi-select-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent-color);
    border: 1.5px solid #ccc;
    border-radius: 4px;
}

.multi-select-option span {
    font-size: 0.95rem;
    color: var(--text-color);
}

/* Developer Footer */
.dev-footer {
    padding: 1rem 0;
    margin-top: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.dev-btn {
    color: var(--accent-color);
    font-weight: 600;
    transition: all 0.2s;
    background: rgba(191, 165, 165, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
}


.dev-btn:hover {
    background: var(--accent-color);
    color: white;
}

/* Premium Mobile Sidebar Toggle (Global) */
/* This overrides the default toggle button styles for mobile */
@media (max-width: 768px) {
    /* Target the button by ID if possible, or by class structure if consistent */
    /* Based on sidebar.php, the button ID is sidebarToggle */

    #sidebarToggle {
        display: flex !important;
        /* Ensure it is visible on mobile */
        align-items: center;
        justify-content: center;
        background: white;
        border: 1px solid rgba(0, 0, 0, 0.05);
        width: 44px;
        height: 44px;
        border-radius: 12px;
        color: var(--accent-color);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
        font-size: 1.2rem;
        transition: all 0.3s ease;
        cursor: pointer;
        padding: 0;
        /* Override any default padding */
    }

    #sidebarToggle:active {
        transform: scale(0.95);
        background: var(--accent-color);
        color: white;
    }

    /* Ensure specific icon centering if needed */
    #sidebarToggle i {
        display: block;
        line-height: 1;
    }
}