/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1e40af;
    --secondary-color: #3b82f6;
    --accent-color: #60a5fa;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-color: #1f2937;
    --light-color: #f9fafb;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--light-color);
    color: var(--dark-color);
    line-height: 1.6;
    min-height: 100vh;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    height: 50px;
    width: auto;
    border-radius: 4px;
}

.header-text h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.header-text p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.last-updated {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
}

.home-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: var(--transition);
    font-weight: 500;
}

.home-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.date-time {
    font-size: 0.9rem;
    opacity: 0.9;
}

.nav-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.nav-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Navigation Styles */
.navigation {
    background: white;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 82px;
    z-index: 90;
}

.nav-list {
    list-style: none;
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.nav-item {
    border-right: 1px solid var(--border-color);
}

.nav-item:last-child {
    border-right: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    color: var(--dark-color);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background: var(--accent-color);
    color: white;
}

.nav-link i {
    font-size: 1rem;
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 200px);
}

/* Dashboard Sections */
.dashboard-section {
    display: none;
}

.dashboard-section.active {
    display: block;
}

.section-header {
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.filter-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-select,
.search-input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.filter-select:focus,
.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

.search-input {
    min-width: 250px;
}

.refresh-btn,
.export-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.refresh-btn:hover,
.export-btn:hover {
    background: var(--primary-color);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Cards */
.stat-card,
.dashboard-card,
.chart-card,
.table-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.stat-card:hover,
.dashboard-card:hover,
.chart-card:hover,
.table-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-card:nth-child(1) .stat-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.stat-card:nth-child(2) .stat-icon {
    background: linear-gradient(135deg, var(--success-color), #34d399);
}

.stat-card:nth-child(3) .stat-icon {
    background: linear-gradient(135deg, var(--warning-color), #fbbf24);
}

.stat-card:nth-child(4) .stat-icon {
    background: linear-gradient(135deg, var(--accent-color), #93c5fd);
}

.stat-content h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-color);
}

.dashboard-card h3,
.chart-card h3,
.table-card h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--dark-color);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.action-btn {
    background: white;
    border: 2px solid var(--border-color);
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    color: var(--dark-color);
}

.action-btn:hover {
    border-color: var(--accent-color);
    background: var(--accent-color);
    color: white;
    transform: translateX(5px);
}

/* Department Info */
.department-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.department-info p {
    font-size: 0.9rem;
    color: var(--dark-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.department-info p:last-child {
    border-bottom: none;
}

.department-info strong {
    color: var(--primary-color);
}

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    padding: 0.75rem;
    background: var(--light-color);
    border-radius: 6px;
    border-left: 4px solid var(--accent-color);
}

.activity-time {
    font-size: 0.8rem;
    color: #6b7280;
    display: block;
    margin-bottom: 0.25rem;
}

.activity-text {
    font-size: 0.9rem;
    color: var(--dark-color);
}

/* Chart Container */
.chart-container {
    grid-column: span 1;
}

.chart-container.full-width {
    grid-column: span 2;
}

.chart-wrapper {
    position: relative;
    height: 300px;
}

/* Table Container */
.table-container {
    width: 100%;
    margin-bottom: 2rem;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* Remove horizontal scrollbar for tables */
.table-wrapper {
    overflow-x: visible;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    table-layout: fixed;
}

.data-table th {
    background: var(--primary-color);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    word-wrap: break-word;
}

.data-table tbody tr:hover {
    background: var(--light-color);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Adjust column widths for the new ration card table */
#rationCardTalukaTable {
    width: 100%;
    table-layout: auto;
}

#rationCardTalukaTable th:nth-child(1),
#rationCardTalukaTable td:nth-child(1) {
    width: 5%;
    text-align: center;
    min-width: 50px;
}

#rationCardTalukaTable th:nth-child(2),
#rationCardTalukaTable td:nth-child(2) {
    width: 12%;
    text-align: left;
    min-width: 100px;
}

#rationCardTalukaTable th:nth-child(3),
#rationCardTalukaTable td:nth-child(3),
#rationCardTalukaTable th:nth-child(4),
#rationCardTalukaTable td:nth-child(4),
#rationCardTalukaTable th:nth-child(5),
#rationCardTalukaTable td:nth-child(5),
#rationCardTalukaTable th:nth-child(6),
#rationCardTalukaTable td:nth-child(6),
#rationCardTalukaTable th:nth-child(7),
#rationCardTalukaTable td:nth-child(7),
#rationCardTalukaTable th:nth-child(8),
#rationCardTalukaTable td:nth-child(8),
#rationCardTalukaTable th:nth-child(9),
#rationCardTalukaTable td:nth-child(9),
#rationCardTalukaTable th:nth-child(10),
#rationCardTalukaTable td:nth-child(10),
#rationCardTalukaTable th:nth-child(11),
#rationCardTalukaTable td:nth-child(11),
#rationCardTalukaTable th:nth-child(12),
#rationCardTalukaTable td:nth-child(12) {
    width: 7%;
    text-align: right;
    min-width: 60px;
}

#rationCardTalukaTable th {
    text-align: center;
    vertical-align: middle;
    font-size: 0.85rem;
    padding: 0.75rem 0.5rem;
}

#rationCardTalukaTable td {
    text-align: right;
    padding: 0.75rem 0.5rem;
    font-size: 0.9rem;
}

#rationCardTalukaTable td:nth-child(2) {
    text-align: left;
}

#rationCardTalukaTable .table-wrapper {
    overflow-x: auto;
    max-width: 100%;
}

/* Adjust column widths */
.data-table th:nth-child(1),
.data-table td:nth-child(1) {
    width: 20%;
}

.data-table th:nth-child(2),
.data-table td:nth-child(2),
.data-table th:nth-child(3),
.data-table td:nth-child(3),
.data-table th:nth-child(4),
.data-table td:nth-child(4) {
    width: 15%;
}

.data-table th:nth-child(5),
.data-table td:nth-child(5) {
    width: 20%;
}

.data-table th:nth-child(6),
.data-table td:nth-child(6) {
    width: 15%;
}

/* Status Badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.status-badge.completed {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.pending {
    background: #fed7aa;
    color: #92400e;
}

.status-badge.rejected {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.active {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.inactive {
    background: #f3f4f6;
    color: #6b7280;
}

/* Footer */
.footer {
    background: var(--dark-color);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer-content p {
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .data-table-container {
        grid-column: span 1;
    }
    
    .chart-container.full-width {
        grid-column: span 1;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .header-container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .header-info {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 0 1rem;
    }
    
    .header-text h1 {
        font-size: 1.3rem;
    }
    
    .header-text p {
        font-size: 0.8rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .nav-list {
        flex-direction: column;
        padding: 0;
    }
    
    .nav-item {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-link {
        padding: 1rem;
    }
    
    .navigation {
        position: static;
    }
    
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-input {
        min-width: auto;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .chart-wrapper {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .header-left {
        flex-direction: column;
        text-align: center;
    }
    
    .header-right {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .header-info {
        width: 100%;
        justify-content: space-between;
    }
    
    .section-header h2 {
        font-size: 1.3rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .chart-wrapper {
        height: 200px;
    }
    
    .dashboard-card,
    .chart-card,
    .table-card {
        padding: 1rem;
    }
    
    .data-table {
        font-size: 0.8rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
}

/* Full screen optimization */
@media (min-width: 1400px) {
    .main-content {
        max-width: 1600px;
        padding: 2rem 3rem;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
        gap: 2rem;
    }
    
    .chart-wrapper {
        height: 350px;
    }
}

@media (min-width: 1800px) {
    .main-content {
        max-width: 2000px;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    }
    
    .chart-wrapper {
        height: 400px;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
