/* AMCS - Automatic Milk Collection System */
@import url('https://fonts.googleapis.com/css2?family=Anek+Gujarati:wght@400;500;600;700&family=Shrikhand&display=swap');

:root {
    --primary: #1a5276;
    --primary-dark: #0e3a5c;
    --secondary: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #c0392b;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --amul-red: #d42027;
    --amul-green: #006838;
    --border: #bdc3c7;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --radius: 6px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Anek Gujarati', 'Shrikhand', 'Segoe UI', sans-serif;
    background: #d4e6f1;
    color: var(--dark);
    font-size: 14px;
    line-height: 1.5;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a5276 0%, #2980b9 50%, #3498db 100%);
}

.login-box {
    background: #f0f0f0;
    border: 2px solid #999;
    border-radius: 8px;
    width: 420px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    overflow: hidden;
}

.login-titlebar {
    background: linear-gradient(to bottom, #4a90d9, #2c6fad);
    color: white;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-titlebar .icon { font-size: 16px; }

.login-body {
    padding: 20px 30px 25px;
    display: flex;
    gap: 20px;
}

.login-logo {
    flex-shrink: 0;
    width: 100px;
    text-align: center;
}

.login-logo .amul-text {
    color: var(--amul-red);
    font-size: 28px;
    font-weight: 700;
    font-style: italic;
    line-height: 1;
}

.login-logo .amcs-text {
    color: var(--dark);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 2px;
}

.login-logo .logo-icon {
    width: 80px;
    height: 80px;
    margin: 10px auto;
    background: linear-gradient(135deg, var(--amul-red), #ff6b6b);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 36px;
}

.login-form { flex: 1; }

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #aaa;
    border-radius: 3px;
    font-size: 13px;
    font-family: inherit;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(26,82,118,0.2);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 10px 0 15px;
    font-size: 12px;
}

.btn-group {
    display: flex;
    gap: 8px;
}

.btn {
    padding: 6px 20px;
    border: 1px solid #888;
    border-radius: 3px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-login {
    background: linear-gradient(to bottom, #5cb85c, #449d44);
    color: white;
    border-color: #398439;
}

.btn-login:hover { background: linear-gradient(to bottom, #449d44, #398439); }

.btn-cancel {
    background: linear-gradient(to bottom, #f0f0f0, #d4d4d4);
    color: #333;
}

.btn-cancel:hover { background: linear-gradient(to bottom, #d4d4d4, #bbb); }

.btn-ok {
    background: linear-gradient(to bottom, #5cb85c, #449d44);
    color: white;
    border-color: #398439;
    padding: 6px 30px;
}

.btn-ok:hover { background: linear-gradient(to bottom, #449d44, #398439); }

.login-footer {
    padding: 4px 12px;
    font-size: 11px;
    color: #666;
    border-top: 1px solid #ccc;
    background: #e8e8e8;
}

.alert {
    padding: 8px 12px;
    border-radius: var(--radius);
    margin-bottom: 12px;
    font-size: 13px;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* ===== SOCIETY SELECTION ===== */
.select-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a5276, #3498db);
}

.select-box {
    background: #f0f0f0;
    border: 2px solid #999;
    border-radius: 8px;
    width: 380px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.select-body {
    padding: 25px 30px;
}

.select-body .form-group { margin-bottom: 18px; }

.select-body select.form-control {
    height: 32px;
    cursor: pointer;
}

.select-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

/* ===== MAIN APPLICATION ===== */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Title Bar */
.app-titlebar {
    background: linear-gradient(to bottom, #4a90d9, #2c6fad);
    color: white;
    padding: 4px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.app-titlebar .title-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-titlebar .title-right {
    font-size: 12px;
    opacity: 0.9;
}

/* Menu Bar */
.menu-bar {
    background: linear-gradient(to bottom, #f8f8f8, #e0e0e0);
    border-bottom: 1px solid #aaa;
    display: flex;
    padding: 0;
    flex-shrink: 0;
}

.menu-item {
    position: relative;
    padding: 6px 16px;
    font-size: 13px;
    cursor: pointer;
    border-right: 1px solid #ccc;
    user-select: none;
    transition: background 0.15s;
}

.menu-item:hover, .menu-item.active {
    background: linear-gradient(to bottom, #d4e6f1, #aed6f1);
}

.menu-item .dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #aaa;
    box-shadow: var(--shadow);
    min-width: 200px;
    z-index: 1000;
}

.menu-item:hover .dropdown { display: block; }

.dropdown a {
    display: block;
    padding: 8px 16px;
    color: var(--dark);
    text-decoration: none;
    font-size: 13px;
    border-bottom: 1px solid #eee;
}

.dropdown a:hover {
    background: #e8f4fd;
    color: var(--primary);
}

.dropdown a:last-child { border-bottom: none; }

/* Main Layout */
.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Toolbar */
.toolbar {
    width: 48px;
    background: linear-gradient(to right, #e8e8e8, #d4d4d4);
    border-right: 1px solid #aaa;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    gap: 4px;
    flex-shrink: 0;
}

.tool-btn {
    width: 36px;
    height: 36px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #444;
    transition: all 0.15s;
    text-decoration: none;
}

.tool-btn:hover {
    background: #c8dff5;
    border-color: #7fb3d8;
}

.tool-btn.active {
    background: #aed6f1;
    border-color: #5dade2;
}

.tool-separator {
    width: 30px;
    height: 1px;
    background: #bbb;
    margin: 4px 0;
}

/* Content Area */
.content-area {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.main-content {
    flex: 1;
    padding: 8px;
    overflow: auto;
    background: #c8dce8;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    height: 100%;
    min-height: 500px;
}

.panel {
    background: white;
    border: 1px solid #999;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    background: linear-gradient(to bottom, #5dade2, #2e86c1);
    color: white;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.panel-header.green {
    background: linear-gradient(to bottom, #58d68d, #28b463);
}

.panel-header.orange {
    background: linear-gradient(to bottom, #f5b041, #e67e22);
}

.panel-header.purple {
    background: linear-gradient(to bottom, #bb8fce, #8e44ad);
}

.panel-body {
    flex: 1;
    overflow: auto;
    padding: 0;
}

.panel-body canvas {
    padding: 10px;
}

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table th {
    background: #e8f0fe;
    padding: 5px 8px;
    text-align: left;
    border-bottom: 2px solid #b0c4de;
    font-weight: 600;
    position: sticky;
    top: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table td {
    padding: 4px 8px;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table tr:hover td {
    background: #f0f7ff;
}

.data-table .num { text-align: right; }

/* Right Sidebar */
.right-sidebar {
    width: 200px;
    background: linear-gradient(to bottom, #eaf2f8, #d4e6f1);
    border-left: 1px solid #aaa;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-logo {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #bbb;
}

.sidebar-logo .amul-text {
    color: var(--amul-red);
    font-size: 22px;
    font-weight: 700;
    font-style: italic;
}

.sidebar-logo .amcs-text {
    color: var(--dark);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
}

.sidebar-section {
    padding: 10px 12px;
    border-bottom: 1px solid #ccc;
}

.sidebar-section h4 {
    font-size: 12px;
    color: var(--primary);
    margin-bottom: 6px;
}

.notification-item {
    font-size: 11px;
    padding: 4px 0;
    border-bottom: 1px dotted #ccc;
    color: #555;
}

.helpline-box {
    margin-top: auto;
    padding: 12px;
    background: white;
    border: 1px solid #bbb;
    margin: 10px;
    border-radius: 6px;
    text-align: center;
}

.helpline-box .helpline-icon {
    font-size: 32px;
    margin-bottom: 6px;
}

.helpline-box h4 {
    color: var(--amul-red);
    font-size: 13px;
    margin-bottom: 8px;
}

.helpline-box p {
    font-size: 11px;
    color: #555;
    margin: 3px 0;
}

.helpline-box .phone {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

/* ===== PAGE CONTENT (Modules) ===== */
.page-content {
    background: white;
    border: 1px solid #999;
    border-radius: 4px;
    margin: 8px;
    overflow: visible;
}

.page-header {
    background: linear-gradient(to bottom, #5dade2, #2e86c1);
    color: white;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-header h2 {
    font-size: 15px;
    font-weight: 600;
}

.page-body {
    padding: 15px;
    overflow: auto;
}

/* Form Styles */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.btn-primary {
    background: linear-gradient(to bottom, #5dade2, #2e86c1);
    color: white;
    border-color: #2471a3;
}

.btn-primary:hover { background: linear-gradient(to bottom, #2e86c1, #2471a3); }

.btn-success {
    background: linear-gradient(to bottom, #58d68d, #28b463);
    color: white;
    border-color: #1e8449;
}

.btn-danger {
    background: linear-gradient(to bottom, #ec7063, #c0392b);
    color: white;
    border-color: #a93226;
}

.btn-sm {
    padding: 3px 10px;
    font-size: 12px;
}

/* Status Bar */
.status-bar {
    background: linear-gradient(to bottom, #e8e8e8, #d0d0d0);
    border-top: 1px solid #aaa;
    padding: 3px 12px;
    font-size: 11px;
    color: #555;
    display: flex;
    justify-content: space-between;
    flex-shrink: 0;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.badge-pending { background: #fdebd0; color: #e67e22; }
.badge-paid { background: #d5f5e3; color: #27ae60; }
.badge-cow { background: #d6eaf8; color: #2e86c1; }
.badge-buffalo { background: #e8daef; color: #8e44ad; }

/* Search Box */
.search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    align-items: center;
}

.search-box input {
    flex: 1;
    max-width: 300px;
}

/* Member Master Tabs & Toolbar */
.header-toolbar, .form-toolbar {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-bottom: 15px;
    border-bottom: 2px solid #b0c4de;
    padding-bottom: 0;
}

.tab-link {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    border: 1px solid #b0c4de;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    background: #e8f0fe;
    margin-bottom: -2px;
}

.tab-link:hover {
    background: #d4e6f1;
}

.tab-link.active {
    background: white;
    color: var(--primary-dark);
    border-bottom: 2px solid white;
    position: relative;
    z-index: 1;
}

.tab-content {
    background: #fafbfc;
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 0 4px 4px 4px;
}

.member-form-header {
    background: #e8f4fd;
    padding: 8px 12px;
    margin-bottom: 10px;
    border: 1px solid #b0c4de;
    border-radius: 4px;
    font-size: 13px;
}

.form-fieldset {
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 12px 15px 5px;
    margin-bottom: 15px;
}

.form-fieldset legend {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    padding: 0 8px;
}

.radio-group {
    display: flex;
    gap: 15px;
    padding-top: 6px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    cursor: pointer;
}

.checkbox-inline label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 24px;
    cursor: pointer;
}

.editable-table .form-control {
    padding: 3px 6px;
    font-size: 12px;
}

.selectable-table tr.selected td {
    background: #d4e6f1 !important;
}

.selectable-table tbody tr {
    cursor: pointer;
}

/* Milk Collection Entry - Split Layout */
.collection-entry-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 15px;
    min-height: 480px;
}

.collection-form-panel {
    background: #f8fafc;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 15px;
}

.collection-grid-panel {
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.collection-grid-panel .panel-header {
    background: linear-gradient(to bottom, #e8f4fd, #d4e6f1);
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 1px solid #b0c4de;
}

.collection-grid-scroll {
    flex: 1;
    overflow: auto;
    max-height: 520px;
}

.collection-grid-scroll .data-table {
    font-size: 12px;
}

.collection-grid-scroll .data-table th,
.collection-grid-scroll .data-table td {
    padding: 4px 6px;
}

/* Rate Chart Grid */
.rate-chart-scroll {
    overflow: auto;
    max-height: 500px;
    border: 1px solid #ddd;
    margin: 10px 0;
}

.rate-chart-table th,
.rate-chart-table td {
    text-align: center;
    padding: 2px;
    min-width: 70px;
}

.rate-cell-input {
    width: 65px !important;
    padding: 2px 4px !important;
    font-size: 11px !important;
    text-align: center;
}

.purchase-summary {
    background: #f0f8ff;
    border: 1px solid #b0c4de;
    border-radius: 4px;
    padding: 12px;
    margin: 15px 0;
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }
    .right-sidebar { display: none; }
    .collection-entry-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .login-body { flex-direction: column; align-items: center; }
    .menu-bar { flex-wrap: wrap; }
}
