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

:root {
    --primary: #0066cc;
    --secondary: #6c757d;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #343a40;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.navbar {
    background-color: var(--dark);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.logo-text {
    font-size: 2.2rem !important;
    font-weight: 900 !important;
    font-style: italic;
    background: linear-gradient(135deg, #00d4ff, #0099ff, #0066ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 3px;
    text-shadow: 2px 2px 8px rgba(0, 150, 255, 0.3);
    transition: all 0.3s ease;
}

.logo-text:hover {
    transform: scale(1.05);
    letter-spacing: 5px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.1);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 20px;
    padding-left: 20px;
    border-left: 1px solid rgba(255,255,255,0.2);
}

.user-name {
    font-weight: bold;
}

.user-role {
    color: #aaa;
    font-size: 0.9rem;
}

.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

.footer {
    background-color: var(--dark);
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 3rem;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 1rem;
}

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

.btn-primary:hover {
    background-color: #0052a3;
}

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

.btn-success:hover {
    background-color: #218838;
}

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

.btn-danger:hover {
    background-color: #c82333;
}

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

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.btn-block {
    display: block;
    width: 100%;
}

.card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #dee2e6;
    background-color: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.card-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.card-body {
    padding: 1.5rem;
}

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

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.table th {
    background-color: #f8f9fa;
    font-weight: bold;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
}

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

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    font-weight: bold;
    border-radius: 4px;
}

.badge-info {
    background-color: var(--info);
    color: white;
}

.badge-warning {
    background-color: var(--warning);
    color: var(--dark);
}

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

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

.badge-secondary {
    background-color: var(--secondary);
    color: white;
}

.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    font-size: 3rem;
}

.stat-info h3 {
    margin: 0;
    font-size: 2rem;
    color: var(--primary);
}

.stat-info p {
    margin: 0;
    color: #666;
}

.stat-success .stat-info h3 {
    color: var(--success);
}

.stat-warning .stat-info h3 {
    color: var(--warning);
}

.stat-info .stat-info h3 {
    color: var(--info);
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.col-md-4 {
    flex: 0 0 33.333%;
    padding: 0 10px;
}

.col-md-8 {
    flex: 0 0 66.666%;
    padding: 0 10px;
}

.col-md-3 {
    flex: 0 0 25%;
    padding: 0 10px;
}

.col-md-2 {
    flex: 0 0 16.666%;
    padding: 0 10px;
}

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

.page-header h1 {
    margin: 0;
}

.text-center {
    text-align: center;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #666;
    font-size: 1.5rem;
}

.login-footer {
    margin-top: 1.5rem;
    text-align: center;
    color: #666;
}

.filter-form {
    display: flex;
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}

.mobile-menu-toggle span {
    width: 100%;
    height: 3px;
    background: white;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* ========================================
   TABLET & MOBILE OPTIMIZATION
   ======================================== */

/* Tablet & Mobile - Hamburger Menu Activation */
@media (max-width: 1180px) {
    /* Show Mobile Menu Toggle for Tablets & Mobile */
    .mobile-menu-toggle {
        display: flex;
    }

    /* Off-Canvas Navigation Menu */
    .nav-menu {
        position: fixed;
        top: 60px;
        right: -100%;
        width: 320px;
        max-width: 85vw;
        height: calc(100vh - 60px);
        background: var(--dark);
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        padding: 1.5rem 1rem;
        box-shadow: -5px 0 20px rgba(0,0,0,0.5);
        transition: right 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
        overflow-y: auto;
        z-index: 999;
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .nav-link {
        width: 100%;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        font-size: 1rem;
    }
    
    .user-menu {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin: 1rem 0 0 0;
        padding: 1rem 1rem 0 1rem;
        border-left: none;
        border-top: 2px solid rgba(255,255,255,0.2);
    }
    
    .user-menu .btn {
        width: 100%;
    }
    
    .navbar {
        padding: 0.75rem 0;
    }
    
    .navbar .container {
        position: relative;
    }
    
    .logo-text {
        font-size: 1.8rem !important;
        letter-spacing: 2px;
    }
    
    /* Overlay for menu */
    .nav-menu.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
        animation: fadeIn 0.3s;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
}

/* Desktop Only - Hide Hamburger */
@media (min-width: 1181px) {
    .mobile-menu-toggle {
        display: none !important;
    }
    
    .nav-menu {
        position: static !important;
        width: auto !important;
        height: auto !important;
        flex-direction: row !important;
        padding: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
    }
}

/* Tablet Portrait & Mobile Landscape */
@media (max-width: 768px) {
    .nav-menu {
        width: 280px;
        top: 70px;
        height: calc(100vh - 70px);
    }
    
    /* Grid & Layout */
    .col-md-4, .col-md-8, .col-md-3, .col-md-2 {
        flex: 0 0 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    /* Touch-Friendly Buttons */
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 1.1rem;
        min-height: 44px; /* iOS recommended touch target */
        min-width: 44px;
    }
    
    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 1rem;
        min-height: 38px;
    }
    
    /* Larger Form Inputs for Touch */
    .form-control, .form-select {
        padding: 0.75rem;
        font-size: 1.1rem;
        min-height: 44px;
    }
    
    /* Table Responsiveness */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem;
        padding: 0 1rem;
        box-shadow: inset -5px 0 10px -5px rgba(0,0,0,0.1);
    }
    
    .table {
        font-size: 0.9rem;
        min-width: 600px;
    }
    
    .table th,
    .table td {
        padding: 0.6rem 0.5rem;
        white-space: nowrap;
        font-size: 0.9rem;
    }
    
    .table thead th {
        position: sticky;
        top: 0;
        background: var(--dark);
        color: white;
        z-index: 2;
    }
    
    /* Card Tables for Small Screens */
    .card .table {
        margin-bottom: 0;
    }
    
    /* Horizontal Scroll Indicator */
    .table-responsive::after {
        content: '← Kaydır →';
        display: block;
        text-align: center;
        padding: 0.5rem;
        color: #999;
        font-size: 0.85rem;
        background: linear-gradient(to right, transparent, rgba(0,0,0,0.05), transparent);
    }
    
    /* Cards */
    .card-body {
        padding: 1rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
}

/* Mobile Portrait */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .container {
        padding: 0 10px;
    }
    
    .logo-text {
        font-size: 1.5rem !important;
        letter-spacing: 1px;
    }
    
    .btn {
        padding: 0.85rem 1rem;
        font-size: 1rem;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn-sm {
        padding: 0.6rem 0.75rem;
        font-size: 0.95rem;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 0.4rem;
    }
}

/* Touch Device Specific */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .btn:hover {
        transform: none;
    }
    
    /* Add active state instead */
    .btn:active {
        transform: scale(0.95);
        opacity: 0.8;
    }
    
    .table tbody tr:hover {
        background-color: inherit;
    }
    
    .table tbody tr:active {
        background-color: #e9ecef;
    }
}

/* Landscape Orientation */
@media (max-height: 500px) and (orientation: landscape) {
    .navbar {
        padding: 0.5rem 0;
    }
    
    .main-content {
        padding: 1rem 0;
    }
}

/* ========================================
   MOBILE CARD VIEW SYSTEM
   ======================================== */

/* Desktop: Show table, hide cards */
.table-view {
    display: block;
}

.mobile-card-view {
    display: none;
}

/* Mobile: Hide table, show cards */
@media (max-width: 768px) {
    .table-view {
        display: none;
    }
    
    .mobile-card-view {
        display: block;
    }
    
    /* Project Card Styles */
    .project-card {
        background: white;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        margin-bottom: 1rem;
        overflow: hidden;
        box-shadow: 0 2px 4px rgba(0,0,0,0.08);
        transition: box-shadow 0.2s;
    }
    
    .project-card:active {
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    }
    
    .project-card-header {
        background: linear-gradient(135deg, var(--primary) 0%, #002855 100%);
        color: white;
        padding: 1rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
        user-select: none;
    }
    
    .project-card-title {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .project-card-title strong {
        font-size: 1.1rem;
        color: var(--warning);
    }
    
    .project-name {
        font-size: 0.9rem;
        opacity: 0.95;
    }
    
    .toggle-icon {
        font-size: 1.2rem;
        margin-left: 0.5rem;
        transition: transform 0.3s;
    }
    
    .project-card-body {
        padding: 1rem;
        display: none;
        animation: slideDown 0.3s ease;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .info-row {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 0.75rem 0;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .info-row:last-of-type {
        border-bottom: none;
    }
    
    .info-label {
        font-weight: 600;
        color: var(--primary);
        flex: 0 0 40%;
        font-size: 0.95rem;
    }
    
    .info-value {
        flex: 1;
        text-align: right;
        color: #495057;
        font-size: 0.95rem;
    }
    
    .project-card-actions {
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 2px solid #e9ecef;
        display: flex;
        gap: 0.5rem;
    }
    
    .project-card-actions .btn {
        flex: 1;
        margin-bottom: 0;
    }
    
    /* Maliyet Formu Mobile - Horizontal Scroll */
    .cost-form-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -15px;
        padding: 0 15px;
    }
    
    .cost-form-wrapper table {
        min-width: 600px;
        font-size: 0.85rem;
    }
    
    .cost-form-wrapper th,
    .cost-form-wrapper td {
        padding: 0.5rem 0.3rem;
        white-space: nowrap;
    }
    
    .cost-form-wrapper input.form-control-sm {
        min-width: 60px;
        font-size: 0.8rem;
        padding: 0.25rem;
    }
    
    /* Form Mobile Uyumluluk */
    .form-group label {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
    }
    
    .form-control,
    .form-select {
        font-size: 1rem;
        padding: 0.75rem;
        min-height: 44px;
    }
    
    textarea.form-control {
        min-height: 100px;
    }
    
    .btn {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* Tablet Landscape (Yatay) Modunda Optimizasyon */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
    .container {
        max-width: 100%;
        padding: 0 20px;
    }
    
    .cost-form-wrapper table {
        font-size: 0.9rem;
    }
    
    .form-control,
    .form-select {
        font-size: 0.95rem;
        padding: 0.6rem;
    }
    
    /* Hamburger menü tablet yatayda da göster */
    .mobile-menu-toggle {
        display: flex !important;
    }
    
    .nav-menu {
        position: fixed;
        top: 60px;
        right: -100%;
        width: 280px;
        height: calc(100vh - 60px);
        background: white;
        flex-direction: column;
        align-items: flex-start;
        box-shadow: -2px 0 10px rgba(0,0,0,0.1);
        transition: right 0.3s ease;
        padding: 20px;
        overflow-y: auto;
        z-index: 998;
    }
    
    .nav-menu.active {
        right: 0;
    }
}

/* Genel Mobile Form İyileştirmeleri - Tüm Cihazlar */
@media (max-width: 1024px) {
    /* Scroll indicator for horizontal tables */
    .table-responsive-mobile {
        position: relative;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-responsive-mobile::after {
        content: "→ Kaydırın";
        position: absolute;
        right: 0;
        top: 0;
        background: linear-gradient(to right, transparent, rgba(243, 156, 18, 0.9));
        color: white;
        padding: 5px 10px;
        font-size: 0.75rem;
        border-radius: 0 0 0 8px;
        pointer-events: none;
        animation: slideHint 2s ease-in-out infinite;
    }
    
    @keyframes slideHint {
        0%, 100% { opacity: 1; transform: translateX(0); }
        50% { opacity: 0.6; transform: translateX(-5px); }
    }
    
    .table-responsive-mobile::-webkit-scrollbar {
        height: 8px;
    }
    
    .table-responsive-mobile::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }
    
    .table-responsive-mobile::-webkit-scrollbar-thumb {
        background: #F39C12;
        border-radius: 4px;
    }
    
    /* Card sistemine dönüştürme - alternatif */
    .mobile-form-card {
        background: white;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 1rem;
        margin-bottom: 1rem;
        box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    }
    
    .mobile-form-card h5 {
        color: #003366;
        margin-bottom: 0.75rem;
        font-size: 1rem;
        border-bottom: 2px solid #F39C12;
        padding-bottom: 0.5rem;
    }
    
    .mobile-form-row {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .mobile-form-row:last-child {
        border-bottom: none;
    }
    
    .mobile-form-label {
        font-weight: 600;
        color: #495057;
        flex: 0 0 45%;
    }
    
    .mobile-form-value {
        flex: 1;
        text-align: right;
    }
}

/* Mobile/Desktop View Toggle */
.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: block !important;
    }
    
    /* Mobile Card/Panel Styles */
    .mobile-card {
        background: white;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        margin-bottom: 15px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.08);
        overflow: hidden;
    }
    
    .mobile-card-header {
        background: linear-gradient(135deg, #003366, #004080);
        color: white;
        padding: 12px 15px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 3px solid #F39C12;
    }
    
    .mobile-card-header strong {
        font-size: 1.05rem;
        display: block;
    }
    
    .mobile-card-body {
        padding: 12px 15px;
    }
    
    .mobile-row {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .mobile-row:last-child {
        border-bottom: none;
    }
    
    .mobile-label {
        font-weight: 600;
        color: #495057;
        flex: 0 0 40%;
        font-size: 0.9rem;
    }
    
    .mobile-row > span:last-child {
        flex: 1;
        text-align: right;
        color: #212529;
        word-break: break-word;
    }
    
    .mobile-card-footer {
        padding: 10px 15px;
        background: #f8f9fa;
        border-top: 1px solid #dee2e6;
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .mobile-card-footer .btn {
        flex: 1;
        min-width: calc(50% - 4px);
    }
    
    /* Template Cards for Forms Page */
    .template-mobile-card {
        background: white;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        margin-bottom: 12px;
        overflow: hidden;
        box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    }
    
    .template-mobile-header {
        background: linear-gradient(135deg, #4a90e2, #357abd);
        color: white;
        padding: 12px 15px;
        font-size: 1rem;
    }
    
    .template-mobile-desc {
        padding: 10px 15px;
        color: #6c757d;
        font-size: 0.9rem;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .template-mobile-actions {
        padding: 10px 15px;
        background: #f8f9fa;
        display: flex;
        gap: 8px;
    }
    
    .template-mobile-actions .btn {
        flex: 1;
        font-size: 0.85rem;
        padding: 6px 10px;
    }
    
    /* Form Templates Page - Stack columns on mobile */
    .row > .col-md-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        margin-bottom: 20px;
    }
}
