/* styles.css - Premium Glassmorphism Theme with Georgian Typography */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Georgian:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #0f1524;
    --glass-card: rgba(18, 25, 41, 0.65);
    --glass-border: rgba(255, 255, 255, 0.07);
    --glass-highlight: rgba(255, 255, 255, 0.03);
    
    --accent-gold: #d4af37;
    --accent-gold-hover: #f3cf5b;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #60a5fa;
    --accent-emerald: #10b981;
    --accent-emerald-hover: #34d399;
    --accent-rose: #f43f5e;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    --font-primary: 'Outfit', 'Noto Sans Georgian', sans-serif;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-primary);
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(212, 175, 55, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-gold);
}

/* Layout Wrapper */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background: var(--glass-card);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-right: 1px solid var(--glass-border);
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 3rem;
}

.logo-icon {
    font-size: 2rem;
    color: var(--accent-gold);
    animation: pulse 2s infinite;
}

.logo-text h2 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 1px;
    background: linear-gradient(45deg, var(--text-primary), var(--accent-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text p {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 18px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-weight: 500;
    border: 1px solid transparent;
}

.nav-item a:hover {
    background: var(--glass-highlight);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.05);
    transform: translateX(5px);
}

.nav-item.active a {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15) 0%, rgba(212, 175, 55, 0.03) 100%);
    border: 1px solid rgba(212, 175, 55, 0.25);
    color: var(--accent-gold);
}

.sidebar-footer {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
    border-top: 1px solid var(--glass-border);
    padding-top: 1.5rem;
}

/* Main Content Area */
.main-content {
    margin-left: 280px;
    flex-grow: 1;
    padding: 2.5rem;
    min-height: 100vh;
}

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

.page-title h1 {
    font-size: 2.2rem;
    font-weight: 700;
}

.page-title p {
    color: var(--text-muted);
    margin-top: 4px;
    font-size: 0.95rem;
}

/* Glass Cards */
.glass-card {
    background: var(--glass-card);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    box-shadow: var(--shadow-main);
    transition: var(--transition);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

/* Stats Cards Container */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-info p {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-info h3 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-top: 5px;
    color: var(--text-primary);
}

.stat-icon-wrapper {
    width: 55px;
    height: 55px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon-wrapper.gold {
    background: rgba(212, 175, 55, 0.15);
    color: var(--accent-gold);
    border: 1px solid rgba(212, 175, 55, 0.25);
}

.stat-icon-wrapper.blue {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.stat-icon-wrapper.emerald {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.stat-icon-wrapper.rose {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent-rose);
    border: 1px solid rgba(244, 63, 94, 0.25);
}

/* Dashboard Content Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 2.5rem;
}

/* Tables styling */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.table-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

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

.custom-table th {
    padding: 14px 16px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--glass-border);
}

.custom-table td {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.95rem;
    vertical-align: middle;
}

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

.custom-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-active {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-overdue {
    background: rgba(244, 63, 94, 0.12);
    color: var(--accent-rose);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.badge-paid {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-blue);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-gold) 0%, #b89326 100%);
    color: #000;
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-gold-hover) 0%, var(--accent-gold) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-blue {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.btn-blue:hover {
    background: var(--accent-blue);
    color: #fff;
    transform: translateY(-2px);
}

.btn-emerald {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.btn-emerald:hover {
    background: var(--accent-emerald);
    color: #fff;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-danger {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent-rose);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.btn-danger:hover {
    background: var(--accent-rose);
    color: #fff;
    transform: translateY(-2px);
}

/* Forms layout */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
    width: 100%;
}

.form-control option, select option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-gold);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* Interactive Device Multi-Form styling */
.device-item-card {
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    background: rgba(255, 255, 255, 0.01);
    transition: var(--transition);
}

.device-item-card:hover {
    border-color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.01);
}

.remove-device-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    color: var(--accent-rose);
    cursor: pointer;
    background: none;
    border: none;
    font-size: 1.1rem;
    padding: 5px;
    transition: var(--transition);
}

.remove-device-btn:hover {
    transform: scale(1.15);
}

/* Custom Image Upload Preview */
.photo-uploader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.02);
    min-height: 120px;
    text-align: center;
}

.photo-uploader:hover {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.03);
}

.photo-uploader.has-image {
    border-style: solid;
    border-color: var(--accent-emerald);
}

.photo-uploader img {
    max-width: 100%;
    max-height: 100px;
    border-radius: 4px;
    object-fit: cover;
    margin-top: 10px;
}

.photo-uploader i {
    font-size: 1.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.photo-uploader span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-box {
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-box {
    transform: translateY(0);
}

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

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

.modal-close:hover {
    color: var(--text-primary);
}

/* Tab contents and section switching */
.app-section {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.app-section.active {
    display: block;
}

/* Client Details View */
.client-details-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

.client-sidebar-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.2rem;
}

.client-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-gold) 0%, #a4821a 100%);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}

.client-meta-info {
    width: 100%;
    margin-top: 1.5rem;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.client-meta-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    padding-bottom: 8px;
}

.client-meta-item:last-child {
    border: none;
}

.client-meta-item span.label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.client-meta-item span.val {
    display: block;
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 3px;
    font-weight: 500;
}

/* Device grids */
.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.device-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
}

.device-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.1);
}

.device-photo {
    height: 160px;
    width: 100%;
    background: #0f1524;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid var(--glass-border);
}

.device-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.device-photo i {
    font-size: 3.5rem;
    color: rgba(255, 255, 255, 0.05);
}

.device-badge {
    position: absolute;
    top: 10px;
    right: 10px;
}

.device-info {
    padding: 1.25rem;
}

.device-info h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.device-info .serial {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.device-pricing {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    padding-top: 12px;
    margin-top: 12px;
}

.device-pricing span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.device-pricing h5 {
    font-size: 1.2rem;
    color: var(--accent-gold);
    font-weight: 700;
}

/* Timeline Comments */
.comments-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 1rem;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 5px;
}

.comment-node {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
}

.comment-node-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.comment-node-body {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Search bar wrapper */
.search-wrapper {
    position: relative;
    flex-grow: 1;
    max-width: 400px;
}

.search-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-wrapper input {
    padding-left: 42px !important;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* --- PRINT-ONLY STYLES FOR THE A4 CONTRACT --- */
@media print {
    body {
        background: #fff !important;
        color: #000 !important;
        background-image: none !important;
    }
    
    .sidebar, .main-content > *:not(.print-container), .modal-overlay, .btn, .page-header {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    .print-container {
        display: block !important;
        background: #fff !important;
        color: #000 !important;
        padding: 2cm !important;
        font-family: 'Noto Sans Georgian', 'Times New Roman', serif !important;
        font-size: 11pt !important;
        line-height: 1.5 !important;
    }
}

.print-container {
    display: none;
}

/* Settings fieldsets and layouts */
fieldset {
    transition: var(--transition);
}
fieldset:hover {
    border-color: rgba(212, 175, 55, 0.25) !important;
    background: rgba(255, 255, 255, 0.02) !important;
}
fieldset legend {
    font-family: var(--font-primary);
    letter-spacing: 1px;
}
#login-container input:focus {
    border-color: var(--accent-gold) !important;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.15) !important;
}
