/* ===================================
   Apartman Yönetim Sistemi
   Modern UI with Tailwind CSS
   =================================== */

/* --- Sidebar Navigation --- */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.875rem;
    margin-bottom: 2px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgba(148, 163, 184, 0.9);
    border-radius: 0.5rem;
    transition: all 0.15s ease;
    text-decoration: none;
    position: relative;
}

.sidebar-link i {
    font-size: 1.05rem;
    width: 1.25rem;
    text-align: center;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.sidebar-link:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-link:hover i {
    opacity: 1;
}

.sidebar-link.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: linear-gradient(to bottom, #3b82f6, #6366f1);
    border-radius: 0 3px 3px 0;
}

.sidebar-link.active i {
    opacity: 1;
    color: #60a5fa;
}

.sidebar-section {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(100, 116, 139, 0.6);
    padding: 1.25rem 0.875rem 0.375rem;
}

/* Sidebar custom scrollbar */
.sidebar-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.sidebar-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.sidebar-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- Dropdown Animation --- */
.animate-dropdown {
    animation: dropdownIn 0.15s ease-out;
}

@keyframes dropdownIn {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* --- Flash Messages --- */
.flash-message {
    animation: flashIn 0.3s ease-out;
}

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

/* --- Custom Form Elements --- */
.form-input,
.form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #334155;
    background-color: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
}

.form-input:focus,
.form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.form-input::placeholder {
    color: #94a3b8;
}

.form-input.error,
.form-select.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

/* --- Modern Card --- */
.card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    background: #ffffff;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #f1f5f9;
    background: #fafbfc;
}

/* --- Modern Table --- */
.data-table {
    width: 100%;
    font-size: 0.8125rem;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    padding: 0.625rem 1rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.data-table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table tfoot th,
.data-table tfoot td {
    padding: 0.625rem 1rem;
    font-weight: 600;
    border-top: 2px solid #e2e8f0;
    font-size: 0.8125rem;
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 9999px;
    line-height: 1.5;
    letter-spacing: 0.01em;
}

.badge-success {
    background: #ecfdf5;
    color: #065f46;
}

.badge-warning {
    background: #fffbeb;
    color: #92400e;
}

.badge-danger {
    background: #fef2f2;
    color: #991b1b;
}

.badge-info {
    background: #eff6ff;
    color: #1e40af;
}

.badge-neutral {
    background: #f1f5f9;
    color: #475569;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.5;
    white-space: nowrap;
}

.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.98); }

.btn-primary {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}
.btn-primary:hover { background: #2563eb; border-color: #2563eb; color: #fff; }

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border-color: #e2e8f0;
}
.btn-secondary:hover { background: #e2e8f0; color: #334155; }

.btn-success {
    background: #10b981;
    color: #fff;
    border-color: #10b981;
}
.btn-success:hover { background: #059669; border-color: #059669; color: #fff; }

.btn-danger {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}
.btn-danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; }

.btn-warning {
    background: #f59e0b;
    color: #fff;
    border-color: #f59e0b;
}
.btn-warning:hover { background: #d97706; border-color: #d97706; color: #fff; }

.btn-ghost {
    background: transparent;
    color: #64748b;
    border-color: transparent;
}
.btn-ghost:hover { background: #f1f5f9; color: #334155; }

.btn-outline-primary {
    background: transparent;
    color: #3b82f6;
    border-color: #3b82f6;
}
.btn-outline-primary:hover { background: #3b82f6; color: #fff; }

.btn-sm {
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    border-radius: 0.375rem;
}

.btn-xs {
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    border-radius: 0.375rem;
}

.btn-icon {
    padding: 0.375rem;
    width: 2rem;
    height: 2rem;
}

.btn-icon.btn-sm {
    width: 1.75rem;
    height: 1.75rem;
    padding: 0.25rem;
}

/* --- Progress Bar --- */
.progress-bar {
    height: 0.5rem;
    background: #e2e8f0;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.5s ease;
}

/* --- Alert / Flash --- */
.alert {
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    border-radius: 0.5rem;
    border: 1px solid;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.alert-success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.alert-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.alert-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

/* --- Stat Card --- */
.stat-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: box-shadow 0.2s ease;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.stat-card .stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    color: #0f172a;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

.modal-content {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 28rem;
    margin: 1rem;
    animation: modalIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* --- Chart.js Fix --- */
canvas {
    max-height: 100% !important;
    max-width: 100% !important;
}

/* --- Checkbox/Radio --- */
.form-checkbox {
    width: 1rem;
    height: 1rem;
    border: 1.5px solid #cbd5e1;
    border-radius: 0.25rem;
    appearance: none;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.form-checkbox:checked {
    background: #3b82f6;
    border-color: #3b82f6;
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
}

/* --- Tabs --- */
.tab-nav {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: -1px;
}

.tab-btn {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    margin-bottom: -1px;
}

.tab-btn:hover {
    color: #334155;
}

.tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

/* --- Loading Spinner --- */
.spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    display: block;
    opacity: 0.5;
}

/* --- Print Styles --- */
@media print {
    #sidebar,
    #sidebarOverlay,
    header,
    .no-print {
        display: none !important;
    }
    
    #main-wrapper {
        padding-left: 0 !important;
    }
    
    main {
        padding: 0 !important;
    }
    
    body {
        background: white !important;
        font-size: 10pt;
    }
    
    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        break-inside: avoid;
    }
    
    .data-table thead th {
        background: #f0f0f0 !important;
    }
    
    @page {
        margin: 10mm;
        size: A4;
    }
}

/* --- Transition Utilities --- */
.transition-default {
    transition: all 0.15s ease;
}

/* --- Scrollbar (Global) --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- Global Loading --- */
#global-loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 9999;
    background: linear-gradient(90deg, #3b82f6 0%, #6366f1 50%, #3b82f6 100%);
    background-size: 200% 100%;
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
    pointer-events: none;
}

#global-loading-bar.loading {
    transform: translateY(0);
    opacity: 1;
    animation: loading-bar-shine 1.2s ease-in-out infinite;
}

#global-loading-bar.loading.page-transition {
    width: 70%;
    animation: loading-bar-progress 0.6s ease-out forwards;
}

@keyframes loading-bar-shine {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes loading-bar-progress {
    0% { width: 0%; }
    70% { width: 70%; }
    100% { width: 100%; }
}

#global-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(248, 250, 252, 0.85);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    pointer-events: none;
}

#global-loading-overlay.loading {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#global-loading-overlay .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: loading-spin 0.7s linear infinite;
}

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

/* SweetAlert her zaman loading overlay üzerinde */
.swal2-container {
    z-index: 10000 !important;
}
