/* ============================================
   MODERN CSS RESET & BASE STYLES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Modern color palette */
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --primary-light: #4895ef;
    --secondary: #7209b7;
    --success: #4cc9f0;
    --danger: #f72585;
    --warning: #f8961e;
    --info: #4cc9f0;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --gray-light: #e9ecef;
    --border: #dee2e6;
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --hover-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius: 12px;
    --sidebar-width: 250px;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
    font-size: 16px;
    -webkit-text-size-adjust: 100%; /* Prevents iOS text zoom */
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--dark);
}

h1 {
    font-size: 2.5rem;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    font-size: 2rem;
    color: var(--primary-dark);
}

h3 {
    font-size: 1.5rem;
    color: var(--dark);
}

p {
    margin-bottom: 1rem;
    color: var(--gray);
}

/* ============================================
   LAYOUT & CONTAINERS
   ============================================ */

.container {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 20px 30px;
}

.main-content {
    margin-left: var(--sidebar-width);
    padding: 30px;
    transition: var(--transition);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--gray-light);
}

/* ============================================
   NAVIGATION & SIDEBAR
   ============================================ */

.navbar {
    background: linear-gradient(135deg, var(--dark) 0%, #2d3748 100%);
    color: white;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 70px;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    height: 100%;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.8rem;
    font-weight: 700;
}

.nav-brand-icon {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 8px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    min-height: 44px; /* Touch-friendly */
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateY(-2px);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-left: 15px;
}

.user-info i {
    font-size: 1.3rem;
    color: var(--primary-light);
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.user-role {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 3px;
}

/* ============================================
   SIDEBAR MODERN
   ============================================ */

.sidebar {
    position: fixed;
    top: 70px;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: white;
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.05);
    padding: 30px 0;
    z-index: 999;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
}

.sidebar-item {
    padding: 0;
    position: relative;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px 30px;
    color: var(--dark);
    text-decoration: none;
    transition: var(--transition);
    border-left: 4px solid transparent;
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    font-weight: 500;
    min-height: 44px; /* Touch-friendly */
    position: relative;
}

.sidebar-link:hover {
    background: linear-gradient(90deg, rgba(67, 97, 238, 0.1), transparent);
    border-left-color: var(--primary);
    color: var(--primary);
    padding-left: 40px;
}

.sidebar-link.active {
    background: linear-gradient(90deg, rgba(67, 97, 238, 0.15), transparent);
    border-left-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-link i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

/* ============================================
   DROPDOWN STYLES - ISPRAVLJENO
   ============================================ */

.dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.dropdown-icon {
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

.dropdown.active .dropdown-icon {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--hover-shadow);
    padding: 10px 0;
    margin-top: 5px;
    display: none;
    z-index: 1000;
    min-width: 200px;
    animation: fadeInDown 0.3s ease;
}

.dropdown.active .dropdown-menu {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 25px;
    color: var(--dark);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.95rem;
    min-height: 44px; /* Touch-friendly */
}

.dropdown-item:hover {
    background: linear-gradient(90deg, rgba(67, 97, 238, 0.1), transparent);
    color: var(--primary);
    padding-left: 30px;
}

.dropdown-item.active {
    background: linear-gradient(90deg, rgba(67, 97, 238, 0.15), transparent);
    color: var(--primary);
    font-weight: 600;
    border-left: 3px solid var(--primary);
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   MOBILE MENU TOGGLE
   ============================================ */

.menu-toggle {
    display: none;
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
    align-items: center;
    justify-content: center;
}

/* ============================================
   CARDS & STATS
   ============================================ */

.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 30px;
    transition: var(--transition);
    border: 1px solid transparent;
    will-change: transform;
    backface-visibility: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--hover-shadow);
    border-color: var(--primary-light);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
    will-change: transform;
    backface-visibility: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--hover-shadow);
    border-color: var(--primary-light);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.stat-icon {
    width: 70px;
    height: 70px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 8px 20px rgba(67, 97, 238, 0.2);
}

.stat-info h3 {
    font-size: 2.5rem;
    margin-bottom: 5px;
    color: var(--dark);
}

.stat-info p {
    color: var(--gray);
    font-size: 0.95rem;
    margin-bottom: 0;
}

/* ============================================
   TABLES
   ============================================ */

.data-table-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    margin-bottom: 30px;
    will-change: transform;
    backface-visibility: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.data-table thead {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.data-table th {
    padding: 20px 15px;
    text-align: left;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--gray-light);
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(67, 97, 238, 0.05), transparent);
}

.data-table td {
    padding: 18px 15px;
    color: var(--dark);
}

.table-danger {
    background-color: rgba(220, 53, 69, 0.1) !important;
}

.table-warning {
    background-color: rgba(255, 193, 7, 0.1) !important;
}

/* ============================================
   FORMS
   ============================================ */

.form-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 25px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.form-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    transition: var(--transition);
    background: var(--light);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
    background: white;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid var(--gray-light);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 44px; /* Touch-friendly */
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(67, 97, 238, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--gray), #5a6268);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(108, 117, 125, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
    min-height: 36px;
}

.btn-icon {
    padding: 10px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.actions {
    display: flex;
    gap: 10px;
}

.btn-action {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    min-height: 36px;
}

.btn-action.edit {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-action.delete {
    background: linear-gradient(135deg, var(--danger), #d81b60);
    color: white;
}

.btn-action:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ============================================
   ALERTS & MESSAGES
   ============================================ */

.alert {
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 2px solid transparent;
    box-shadow: var(--card-shadow);
}

.alert i {
    font-size: 1.3rem;
}

.alert.success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border-color: #28a745;
    color: #155724;
}

.alert.error {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    border-color: #dc3545;
    color: #721c24;
}

.alert.warning {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border-color: #ffc107;
    color: #856404;
}

.alert.info {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    border-color: #17a2b8;
    color: #0c5460;
}

/* ============================================
   BADGES & TAGS
   ============================================ */

.badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    min-width: 24px;
}

.badge-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.badge-success {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
}

.badge-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.badge-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.badge-info {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.badge-notification {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 10px;
    padding: 2px 6px;
    min-width: 18px;
    text-align: center;
}

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 450px;
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 50px;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.login-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
    color: white;
    box-shadow: 0 10px 25px rgba(67, 97, 238, 0.3);
}

.login-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.login-header p {
    color: var(--gray);
    font-size: 0.95rem;
}

/* ============================================
   DASHBOARD SPECIFIC
   ============================================ */

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--gray-light);
}

.dashboard-title {
    font-size: 2.2rem;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dashboard-actions {
    display: flex;
    gap: 15px;
}

.recent-section {
    margin-top: 40px;
}

.section-title {
    font-size: 1.5rem;
    color: var(--dark);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--gray-light);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ============================================
   NO DATA STATES
   ============================================ */

.no-data {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}

.no-data-icon {
    font-size: 4rem;
    color: var(--gray-light);
    margin-bottom: 20px;
}

.no-data h3 {
    color: var(--dark);
    margin-bottom: 10px;
}

.no-data p {
    color: var(--gray);
    margin-bottom: 25px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   INFO BOXES
   ============================================ */

.info-box {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-left: 5px solid var(--primary);
    padding: 25px;
    border-radius: var(--border-radius);
    margin-top: 30px;
}

.info-box h3 {
    color: var(--primary-dark);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-box ul {
    list-style: none;
    padding-left: 0;
}

.info-box li {
    padding: 8px 0;
    position: relative;
    padding-left: 25px;
    color: var(--gray);
}

.info-box li:before {
    content: "✓";
    color: var(--primary);
    font-weight: bold;
    position: absolute;
    left: 0;
    top: 8px;
}

/* ============================================
   SEARCH & FILTERS
   ============================================ */

.search-container {
    margin-bottom: 25px;
    position: relative;
}

.search-input {
    padding: 16px 20px 16px 50px;
    width: 100%;
    max-width: 400px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='%236c757d'%3E%3Cpath fill-rule='evenodd' d='M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z' clip-rule='evenodd'/%3E%3C/svg%3E") no-repeat 20px center;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
    text-align: center;
    margin-top: 50px;
    padding-top: 25px;
    border-top: 2px solid var(--gray-light);
    color: var(--gray);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.footer-links a {
    color: var(--gray);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
}

/* ============================================
   MOBILE FIRST RESPONSIVE DESIGN
   ============================================ */

/* SMARTPHONE OPTIMIZATIONS (MAX 480px) */
@media (max-width: 480px) {
    :root {
        --sidebar-width: 0;
        --border-radius: 10px;
    }
    
    body {
        font-size: 14px;
        line-height: 1.5;
    }
    
    /* TYPOGRAPHY MOBILE */
    h1 {
        font-size: 1.6rem;
        line-height: 1.3;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    p {
        font-size: 0.9rem;
        margin-bottom: 0.8rem;
        line-height: 1.6;
    }
    
    /* LAYOUT MOBILE */
    .container {
        padding: 12px !important;
        max-width: 100% !important;
    }
    
    .main-content {
        padding: 12px !important;
        margin-left: 0 !important;
        padding-top: 60px !important;
        -webkit-overflow-scrolling: touch;
    }
    
    /* NAVBAR MOBILE */
    .navbar {
        height: 60px;
        padding: 0 10px;
        background: var(--dark); /* Simplify gradient for performance */
    }
    
    .nav-container {
        padding: 0 12px !important;
    }
    
    .nav-brand {
        font-size: 1.1rem;
        gap: 10px;
    }
    
    .nav-brand-icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
        border-radius: 8px;
    }
    
    .nav-menu {
        display: none !important;
    }
    
    .user-info {
        display: none !important;
    }
    
    /* SIDEBAR MOBILE */
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        top: 60px;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.15);
        height: -webkit-fill-available; /* iOS fix */
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-link {
        padding: 14px 20px;
        font-size: 0.9rem;
        min-height: 48px;
    }
    
    .sidebar-link:hover {
        padding-left: 25px;
    }
    
    .sidebar-link i {
        font-size: 1.1rem;
    }
    
    /* MOBILE MENU TOGGLE */
    .menu-toggle {
        display: flex !important;
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 1001;
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
    }
    
    /* CARDS & STATS MOBILE */
    .card {
        padding: 18px;
        margin-bottom: 12px;
        transition: opacity 0.3s ease, transform 0.3s ease;
    }
    
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
        margin-bottom: 20px;
    }
    
    .stat-card {
        padding: 18px;
        transition: opacity 0.3s ease, transform 0.3s ease;
    }
    
    .stat-card::before {
        background: var(--primary); /* Simplify gradient */
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
        margin-bottom: 15px;
        border-radius: 12px;
    }
    
    .stat-info h3 {
        font-size: 1.8rem;
    }
    
    /* TABLES MOBILE - Horizontal scroll */
    .data-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
        margin-bottom: 20px;
    }
    
    .data-table {
        min-width: 600px;
        font-size: 0.82rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 8px;
        white-space: nowrap;
    }
    
    .data-table th {
        font-size: 0.75rem;
        padding: 12px 8px;
    }
    
    /* FORMS MOBILE */
    .form-container {
        padding: 18px !important;
        margin: 0 8px;
        border-radius: 10px;
    }
    
    .form-group {
        margin-bottom: 18px;
    }
    
    .form-row {
        grid-template-columns: 1fr !important;
        gap: 0;
    }
    
    .form-control {
        padding: 14px 16px;
        font-size: 16px; /* Prevents iOS zoom */
        border-radius: 8px;
    }
    
    /* BUTTONS MOBILE */
    .btn {
        padding: 14px 20px;
        font-size: 0.95rem;
        width: 100%;
        justify-content: center;
        border-radius: 8px;
        transition: opacity 0.3s ease, transform 0.3s ease;
    }
    
    .btn-sm {
        padding: 10px 14px;
        font-size: 0.85rem;
        min-height: 40px;
        width: auto;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
        padding-top: 20px;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    /* DROPDOWN MOBILE */
    .dropdown-menu {
        position: static !important;
        box-shadow: none;
        margin: 5px 0;
        padding: 0;
        border: 1px solid var(--border);
        border-radius: 8px;
        animation: none;
    }
    
    .dropdown-item {
        padding: 14px 20px;
        font-size: 0.9rem;
    }
    
    /* PAGE HEADER MOBILE */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding-bottom: 15px;
        margin-bottom: 20px;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding-bottom: 15px;
        margin-bottom: 20px;
    }
    
    .dashboard-actions {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }
    
    .dashboard-title {
        font-size: 1.6rem;
    }
    
    /* REGION STATS MOBILE */
    .region-stats {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
    
    .region-stat-card {
        padding: 18px;
        border-radius: 10px;
    }
    
    .region-stat-card::before {
        background: var(--primary);
    }
    
    .region-stat-icon {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
        border-radius: 10px;
    }
    
    .region-stat-info h3 {
        font-size: 1.6rem;
    }
    
    /* SEARCH MOBILE */
    .search-container {
        padding: 15px 12px;
        margin-bottom: 18px;
        border-radius: 10px;
    }
    
    .search-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .search-form {
        grid-template-columns: 1fr !important;
        gap: 10px;
        width: 100%;
    }
    
    .search-input {
        max-width: 100% !important;
        font-size: 16px;
        padding: 14px 20px 14px 45px;
        background-position: 15px center;
    }
    
    /* ACTIONS AND BUTTON GROUPS */
    .actions {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .btn-action {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
        min-height: 36px;
    }
    
    /* ALERTS MOBILE */
    .alert {
        padding: 15px;
        font-size: 0.85rem;
        flex-direction: column;
        text-align: center;
        gap: 8px;
        border-radius: 10px;
    }
    
    .alert i {
        font-size: 1.5rem;
    }
    
    /* FOOTER MOBILE */
    .footer {
        margin-top: 25px;
        padding: 15px 12px;
        font-size: 0.8rem;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 8px;
    }
    
    /* NO DATA STATES MOBILE */
    .no-data {
        padding: 40px 15px;
        border-radius: 10px;
    }
    
    .no-data-icon {
        font-size: 2.5rem;
    }
    
    .no-data h3 {
        font-size: 1.3rem;
    }
    
    /* LOGIN MOBILE */
    .login-box {
        padding: 30px 20px;
        border-radius: 15px;
    }
    
    .login-logo {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .login-header h1 {
        font-size: 1.5rem;
    }
    
    /* SECTION TITLES */
    .section-title {
        font-size: 1.2rem;
        padding-bottom: 12px;
        margin-bottom: 15px;
    }
    
    /* INFO BOXES */
    .info-box {
        padding: 18px;
        margin-top: 20px;
        border-radius: 10px;
    }
    
    /* RECENT SECTION */
    .recent-section {
        margin-top: 25px;
    }
}

/* SMALL TABLETS (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    :root {
        --border-radius: 11px;
    }
    
    body {
        font-size: 15px;
    }
    
    .container {
        padding: 18px;
    }
    
    .main-content {
        padding: 18px;
        padding-top: 80px;
    }
    
    /* TWO COLUMN GRID FOR TABLETS */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 18px;
    }
    
    .region-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 18px;
    }
    
    /* NAVBAR TABLET */
    .navbar {
        height: 65px;
    }
    
    .sidebar {
        top: 65px;
    }
    
    .nav-brand {
        font-size: 1.3rem;
    }
    
    /* FORM ACTIONS HORIZONTAL ON TABLETS */
    .form-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .form-actions .btn {
        width: auto;
        flex: 1;
        min-width: 120px;
    }
    
    /* TABLES TABLET */
    .data-table {
        font-size: 0.88rem;
        min-width: 700px;
    }
    
    /* BUTTONS TABLET */
    .btn {
        width: auto;
    }
    
    /* DASHBOARD TABLET */
    .dashboard-header {
        flex-direction: row;
        align-items: center;
    }
    
    .dashboard-actions {
        flex-direction: row;
    }
    
    /* SEARCH TABLET */
    .search-form {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* TABLETS (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 22px;
        max-width: 100%;
    }
    
    .main-content {
        margin-left: 0;
        padding: 25px;
        padding-top: 90px;
    }
    
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .menu-toggle {
        display: flex;
        top: 20px;
        left: 20px;
        width: 45px;
        height: 45px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 22px;
    }
    
    .region-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .nav-menu {
        gap: 10px;
    }
    
    .nav-link {
        padding: 10px 16px;
        font-size: 0.92rem;
    }
    
    .data-table {
        font-size: 0.92rem;
    }
    
    .card, 
    .stat-card, 
    .region-stat-card {
        padding: 25px;
    }
    
    .form-container {
        padding: 35px;
    }
}

/* SMALL LAPTOPS (1025px - 1200px) */
@media (min-width: 1025px) and (max-width: 1200px) {
    .container {
        max-width: 100%;
        padding: 25px;
    }
    
    .main-content {
        padding: 25px;
    }
    
    .sidebar {
        width: 230px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 22px;
    }
    
    .region-stats {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 18px;
    }
    
    .nav-container {
        padding: 0 25px;
    }
    
    .nav-link {
        padding: 12px 18px;
        font-size: 0.95rem;
    }
    
    .user-info {
        padding: 8px 16px;
    }
}

/* ============================================
   ORIENTATION SPECIFIC FIXES
   ============================================ */
@media (max-width: 768px) and (orientation: landscape) {
    .navbar {
        height: 50px;
    }
    
    .sidebar {
        top: 50px;
        width: 250px;
    }
    
    .main-content {
        padding-top: 60px;
    }
    
    .menu-toggle {
        top: 8px;
        left: 8px;
        width: 40px;
        height: 40px;
    }
    
    /* Reduce padding in landscape */
    .card, 
    .stat-card,
    .form-container {
        padding: 15px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    
    .stats-grid,
    .region-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }
}

/* ============================================
   HIGH DPI/RETINA DISPLAY OPTIMIZATIONS
   ============================================ */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .btn,
    .card,
    .stat-card,
    .nav-link {
        border-width: 0.5px;
    }

    /* Sidebar link na Retini: zadrži samo lijevi rub, izbjegni tanku vodoravnu crtu */
    .sidebar-link {
        border-top-width: 0 !important;
        border-right-width: 0 !important;
        border-bottom-width: 0 !important;
    }
}

/* ============================================
   TOUCH DEVICE SPECIFIC IMPROVEMENTS
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .btn:hover,
    .card:hover,
    .stat-card:hover,
    .sidebar-link:hover,
    .nav-link:hover,
    .dropdown-item:hover,
    .data-table tbody tr:hover,
    .btn-action:hover {
        transform: none !important;
    }
    
    /* Increase tap targets */
    .sidebar-link,
    .dropdown-item {
        padding: 16px 20px;
        min-height: 48px;
    }
    
    .btn-action {
        width: 44px;
        height: 44px;
        min-height: 44px;
    }
    
    /* Better feedback for touch */
    .btn:active,
    .sidebar-link:active,
    .nav-link:active,
    .btn-action:active {
        opacity: 0.8;
        transform: scale(0.98) !important;
    }
    
    /* Active state for buttons */
    .btn:active::before {
        width: 300px;
        height: 300px;
    }
}

/* ============================================
   SAFARI/IOS SPECIFIC FIXES
   ============================================ */
@supports (-webkit-touch-callout: none) {
    .main-content {
        -webkit-overflow-scrolling: touch;
    }
    
    input,
    textarea,
    select,
    .search-input,
    .form-control {
        font-size: 16px !important;
    }
    
    .sidebar {
        height: -webkit-fill-available;
    }
    
    /* Fix for Safari bounce effect */
    body {
        overscroll-behavior-y: none;
    }
}

/* ============================================
   UTILITY CLASSES FOR RESPONSIVE DESIGN
   ============================================ */

.mobile-hide {
    display: none !important;
}

@media (max-width: 768px) {
    .mobile-hide {
        display: none !important;
    }
    
    .mobile-show {
        display: block !important;
    }
    
    .mobile-flex {
        display: flex !important;
    }
    
    .desktop-only {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .mobile-show {
        display: none !important;
    }
    
    .mobile-hide {
        display: block !important;
    }
    
    .mobile-flex {
        display: none !important;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-primary {
    color: var(--primary);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.text-info {
    color: var(--info);
}

.text-gray {
    color: var(--gray);
}

.bg-light {
    background-color: var(--light);
}

.rounded {
    border-radius: var(--border-radius);
}

.shadow {
    box-shadow: var(--card-shadow);
}

.mb-0 {
    margin-bottom: 0;
}

.mt-0 {
    margin-top: 0;
}

.mt-20 {
    margin-top: 20px;
}

.mt-30 {
    margin-top: 30px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mb-30 {
    margin-bottom: 30px;
}

.p-20 {
    padding: 20px;
}

.d-flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.align-items-center {
    align-items: center;
}

.justify-content-between {
    justify-content: space-between;
}

.justify-content-center {
    justify-content: center;
}

.gap-10 {
    gap: 10px;
}

.gap-20 {
    gap: 20px;
}

.gap-30 {
    gap: 30px;
}

/* ============================================
   CUSTOM UTILITIES FOR REGIONS, PODRUZNICE, etc.
   ============================================ */

.region-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.region-stat-card {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    border: 1px solid rgba(67, 97, 238, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.region-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.region-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.12);
}

.region-stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 1.5rem;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 6px 15px rgba(67, 97, 238, 0.25);
}

.region-stat-info h3 {
    font-size: 2.2rem;
    margin-bottom: 5px;
    color: var(--dark);
}

.region-stat-info p {
    color: var(--gray);
    font-size: 0.95rem;
    margin-bottom: 5px;
}

.region-stat-trend {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.trend-up {
    color: #2ecc71;
}

.trend-down {
    color: #e74c3c;
}

.region-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 10px;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.region-actions {
    display: flex;
    gap: 8px;
}

.btn-region {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.region-details {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 10px;
    padding: 15px;
    margin-top: 10px;
    border-left: 4px solid var(--primary);
}

.detail-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 10px;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 3px;
}

.detail-value {
    font-weight: 600;
    color: var(--dark);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}

.empty-icon {
    font-size: 4rem;
    color: #e9ecef;
    margin-bottom: 20px;
}

.empty-title {
    color: var(--dark);
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.empty-description {
    color: var(--gray);
    margin-bottom: 25px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.search-container {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.search-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    align-items: end;
}

/* ============================================
   LOADING OVERLAY
   ============================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    display: none;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   TOOLTIPS
   ============================================ */

.custom-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    z-index: 10000;
    white-space: nowrap;
    pointer-events: none;
    animation: fadeIn 0.2s ease;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .navbar, .sidebar, .page-header .btn, .search-container, 
    .region-actions, .info-box, .table-info, .footer,
    .menu-toggle, .dropdown-menu, .btn-action {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    .container {
        padding: 20px !important;
        max-width: 100% !important;
    }
    
    .data-table-container {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    .data-table th {
        background: #f0f0f0 !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
    }
    
    .badge {
        border: 1px solid #000 !important;
        background: #fff !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
    }
    
    a {
        color: #000 !important;
        text-decoration: none !important;
    }
    
    .region-color {
        -webkit-print-color-adjust: exact;
    }
    
    /* Mobile print optimizations */
    @media (max-width: 768px) {
        .container {
            width: 100% !important;
            max-width: 100% !important;
            padding: 10px !important;
        }
        
        .data-table {
            min-width: 100% !important;
            font-size: 10pt !important;
        }
        
        h1, h2, h3 {
            page-break-after: avoid;
        }
        
        .card, .stat-card {
            page-break-inside: avoid;
        }
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

@media (max-width: 768px) {
   :focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }
}

/* ============================================
   FIXES FOR COMMON ISSUES
   ============================================ */

*:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

table {
    border-spacing: 0;
}

img {
    max-width: 100%;
    height: auto;
}

/* Clearfix */
.clearfix::after {
    content: "";
    clear: both;
    display: table;
}