/* Zaharat Invoice System - Professional Responsive CSS */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #34495e;
    --border-color: #ddd;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f8f9fa;
}

/* RTL Support */
.rtl {
    direction: rtl;
    text-align: right;
}

.rtl .text-left {
    text-align: right !important;
}

.rtl .text-right {
    text-align: left !important;
}

.rtl .float-left {
    float: right !important;
}

.rtl .float-right {
    float: left !important;
}

.rtl .ml-3 {
    margin-right: 1rem !important;
    margin-left: 0 !important;
}

.rtl .mr-3 {
    margin-left: 1rem !important;
    margin-right: 0 !important;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header */
.header {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 4px 20px rgba(52, 152, 219, 0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid #2980b9;
}

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

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.logo i {
    font-size: 1.8rem;
    color: #ffffff;
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 2rem;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(255,255,255,0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.language-switcher {
    display: flex;
    gap: 0.5rem;
}

.language-switcher button {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.language-switcher button:hover,
.language-switcher button.active {
    background: rgba(255,255,255,0.3);
    border-color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Dashboard */
.dashboard {
    padding: 2rem 0;
}

.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: 10px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    background: var(--secondary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--dark-color);
    font-size: 0.9rem;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.table-header {
    background: var(--light-color);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.table-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

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

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: var(--light-color);
    font-weight: 600;
    color: var(--primary-color);
}

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

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    font-size: 0.9rem;
}

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

.btn-primary:hover {
    background: #2980b9;
}

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

.btn-success:hover {
    background: #229954;
}

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

.btn-warning:hover {
    background: #e67e22;
}

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

.btn-danger:hover {
    background: #c0392b;
}

.btn-light {
    background: var(--light-color);
    color: var(--dark-color);
}

.btn-light:hover {
    background: #d5dbdd;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--primary-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark-color);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Invoice Items */
.invoice-items {
    margin-bottom: 1.5rem;
}

.invoice-item {
    display: grid;
    grid-template-columns: 60px 1fr 120px 120px 120px 60px;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.invoice-item .form-control {
    padding: 0.5rem;
}

.invoice-item .btn {
    padding: 0.5rem;
}

.invoice-totals {
    background: var(--light-color);
    padding: 1rem;
    border-radius: 5px;
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 0.5rem;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
}

.total-row.grand-total {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--primary-color);
    border-top: 2px solid var(--primary-color);
    padding-top: 0.5rem;
}

/* Status Badges */
.badge {
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-draft {
    background: #f8f9fa;
    color: var(--dark-color);
}

.badge-sent {
    background: #cce5ff;
    color: #004085;
}

.badge-paid {
    background: #d4edda;
    color: #155724;
}

.badge-overdue {
    background: #f8d7da;
    color: #721c24;
}

.badge-cancelled {
    background: #e2e3e5;
    color: #383d41;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.8);
    color: #2980b9;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    transition: var(--transition);
    z-index: 1001;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    min-height: 44px;
    min-width: 44px;
    backdrop-filter: blur(10px);
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    border-color: white;
}

.mobile-menu-toggle:focus {
    outline: 3px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

.mobile-menu-toggle:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.mobile-menu-toggle i {
    transition: var(--transition);
}

.mobile-menu-toggle:hover i {
    transform: scale(1.1);
}

/* Ensure mobile menu toggle is visible on mobile and tablet */
@media (max-width: 1024px) {
    .mobile-menu-toggle {
        display: block !important;
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        padding: 0.5rem 0.6rem;
        font-size: 1.3rem;
        min-height: 40px;
        min-width: 40px;
    }
}

@media (max-width: 480px) {
    .mobile-menu-toggle {
        padding: 0.4rem 0.5rem;
        font-size: 1.2rem;
        min-height: 36px;
        min-width: 36px;
    }
}

/* Mobile Navigation */
.mobile-nav {
    display: none;
    position: fixed;
    top: 0;
    left: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
}

.mobile-nav.active {
    left: 0;
    display: block;
}

.mobile-nav-header {
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-nav-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 3px;
    transition: var(--transition);
}

.mobile-nav-close:hover {
    background: rgba(255,255,255,0.2);
}

.mobile-nav-menu {
    padding: 1rem 0;
}

.mobile-nav-menu li {
    border-bottom: 1px solid var(--border-color);
}

.mobile-nav-menu a {
    display: block;
    padding: 1rem;
    color: var(--dark-color);
    text-decoration: none;
    transition: var(--transition);
}

.mobile-nav-menu a:hover,
.mobile-nav-menu a.active {
    background: var(--light-color);
    color: var(--secondary-color);
}

.mobile-nav-menu a.active {
    font-weight: bold;
    border-left: 3px solid var(--secondary-color);
}

/* Mobile Language Switcher */
.mobile-language-switcher {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
}

.mobile-language-switcher button {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--dark-color);
    border-radius: 3px;
    cursor: pointer;
    transition: var(--transition);
}

.mobile-language-switcher button:hover,
.mobile-language-switcher button.active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

/* Overlay */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-nav-overlay.active {
    display: block;
    opacity: 1;
}

/* Responsive */
@media (max-width: 1024px) {
    .container {
        padding: 0 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .nav-menu,
    .language-switcher {
        display: none;
    }
    
    .mobile-nav {
        display: block;
    }
}

@media (max-width: 768px) {
    /* Header & Navigation */
    .header {
        padding: 1rem 0;
    }
    
    .header .container {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    
    .logo {
        font-size: 1.2rem;
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
        text-align: center;
    }
    
    .nav-menu li {
        width: 100%;
    }
    
    .nav-menu a {
        display: block;
        padding: 0.8rem;
        border-radius: 5px;
        transition: var(--transition);
    }
    
    .nav-menu a:hover {
        background: var(--secondary-color);
        color: white;
    }
    
    .language-switcher {
        display: flex;
        gap: 0.5rem;
        width: 100%;
        justify-content: center;
    }
    
    .language-switcher button {
        flex: 1;
        padding: 0.5rem;
    }
    
    /* Dashboard */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1.5rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    /* Forms */
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-control {
        padding: 0.8rem;
        font-size: 1rem;
    }
    
    /* Tables */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        font-size: 0.9rem;
        min-width: 600px;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
        white-space: nowrap;
    }
    
    /* Cards */
    .form-card {
        margin-bottom: 1.5rem;
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    /* Buttons */
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        margin: 0.25rem;
    }
    
    .btn-sm {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .btn-lg {
        padding: 0.8rem 1.2rem;
        font-size: 1rem;
    }
    
    /* Modals */
    .modal-content {
        width: 95%;
        margin: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    /* Invoice/Quotation Items */
    .invoice-item,
    .quotation-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 1rem;
    }
    
    .invoice-totals,
    .quotation-totals {
        grid-template-columns: 1fr;
    }
    
    /* Page Headers */
    .page-header {
        padding: 1.5rem 1rem;
        text-align: center;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .page-actions {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .page-actions .btn {
        width: 100%;
    }
    
    /* Table Headers */
    .table-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .search-box {
        width: 100%;
    }
    
    .filter-box {
        width: 100%;
    }
    
    /* Action Buttons */
    .actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .actions .btn {
        width: 100%;
    }
    
    /* Welcome Section */
    .welcome-section {
        text-align: center;
        padding: 2rem 1rem;
    }
    
    .welcome-section h1 {
        font-size: 1.8rem;
    }
    
    /* Recent Sections */
    .recent-section {
        margin-bottom: 2rem;
    }
    
    .recent-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    /* Container */
    .container {
        padding: 0 0.5rem;
    }
    
    /* Header */
    .header {
        padding: 0.5rem 0;
    }
    
    .logo {
        font-size: 1rem;
        text-align: center;
    }
    
    /* Typography */
    body {
        font-size: 14px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    /* Forms */
    .form-control {
        padding: 0.6rem;
        font-size: 14px;
    }
    
    .form-label {
        font-size: 13px;
        margin-bottom: 0.3rem;
    }
    
    /* Buttons */
    .btn {
        padding: 0.5rem 0.8rem;
        font-size: 13px;
        margin: 0.2rem;
    }
    
    .btn-sm {
        padding: 0.3rem 0.5rem;
        font-size: 12px;
    }
    
    .btn-lg {
        padding: 0.7rem 1rem;
        font-size: 14px;
    }
    
    /* Cards */
    .card-body {
        padding: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
        text-align: center;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.9rem;
    }
    
    /* Tables */
    .table {
        font-size: 12px;
        min-width: 500px;
    }
    
    .table th,
    .table td {
        padding: 0.3rem;
    }
    
    /* Modals */
    .modal-content {
        width: 98%;
        margin: 0.5rem;
        padding: 1rem;
    }
    
    /* Invoice/Quotation Items */
    .invoice-item,
    .quotation-item {
        padding: 0.5rem;
    }
    
    .invoice-item input,
    .quotation-item input,
    .invoice-item button,
    .quotation-item button {
        font-size: 12px;
        padding: 0.4rem;
    }
    
    /* Action Buttons in Tables */
    .table .btn-sm {
        padding: 0.2rem 0.4rem;
        font-size: 11px;
    }
    
    /* Form Actions */
    .form-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    /* Print Layout Mobile */
    .print-header .company-name {
        font-size: 1.5rem;
        letter-spacing: 1px;
    }
    
    .print-header .document-type {
        font-size: 1rem;
        letter-spacing: 3px;
    }
    
    .details-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .customer-details-single {
        font-size: 12px;
    }
    
    /* Language Switcher */
    .language-switcher button {
        font-size: 12px;
        padding: 0.4rem;
    }
    
    /* Search and Filter */
    .search-box input,
    .filter-box select {
        font-size: 14px;
        padding: 0.5rem;
    }
    
    /* Status Badges */
    .badge {
        font-size: 10px;
        padding: 0.2rem 0.4rem;
    }
    
    /* Alerts */
    .alert {
        padding: 0.8rem;
        font-size: 13px;
    }
    
    /* Loading Spinner */
    .spinner {
        width: 30px;
        height: 30px;
        border-width: 2px;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        padding: 0.5rem 0;
    }
    
    .nav-menu {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav-menu li {
        flex: 1;
        min-width: 100px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-menu a {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .table .btn-sm {
        min-height: 36px;
        min-width: 36px;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        min-height: 44px;
    }
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--light-color);
    border-top: 3px solid var(--secondary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Alert Messages */
.alert {
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    border-color: var(--success-color);
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    border-color: var(--danger-color);
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border-color: var(--warning-color);
    color: #856404;
}

.alert-info {
    background: #cce5ff;
    border-color: var(--secondary-color);
    color: #004085;
}

/* Print Styles */
@media print {
    .header,
    .nav-menu,
    .language-switcher,
    .table-actions,
    .btn,
    .modal-footer {
        display: none !important;
    }
    
    .modal-content {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    body {
        background: white;
    }
}
