* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #1e293b;
    --bg-darker: #0f172a;
    --card-bg: #ffffff;
    --card-bg-alt: #f8fafc;
    --primary-blue: #2563eb;
    --primary-blue-hover: #1d4ed8;
    --success-green: #10b981;
    --success-green-light: #34d399;
    --danger-red: #ef4444;
    --danger-red-light: #f87171;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --text-white: #ffffff;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
    font-family: 'Cairo', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
    min-height: 100vh;
    color: var(--text-dark);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 30px;
}

.header h1 {
    color: var(--text-white);
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    font-weight: 800;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.header p {
    color: var(--text-light);
    font-size: 1.1rem;
    font-weight: 400;
}

.header-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.card-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.card-title-icon {
    font-size: 1.5rem;
}

/* Mode Switcher */
.mode-switcher {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
    background: var(--card-bg-alt);
    padding: 10px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text-light);
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    background: rgba(37, 99, 235, 0.05);
    color: var(--primary-blue);
}

.mode-btn.active {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.mode-icon {
    font-size: 1.2rem;
}

.input-section-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.input-section-content.active {
    display: block;
}

/* Input Section */
.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.input-group input {
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: var(--card-bg-alt);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.input-group .hint {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 5px;
}

/* Table */
.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 12px;
    overflow: hidden;
}

thead {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #1e40af 100%);
}

thead th {
    color: var(--text-white);
    padding: 15px;
    font-weight: 600;
    text-align: center;
}

tbody tr {
    transition: background 0.2s ease;
}

tbody tr:nth-child(even) {
    background: var(--card-bg-alt);
}

tbody tr:hover {
    background: #e0e7ff;
}

tbody td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

tbody td input {
    width: 100%;
    max-width: 150px;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    text-align: center;
    transition: border-color 0.3s ease;
}

tbody td input:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.btn-remove {
    background: var(--danger-red);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-remove:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Buttons */
.btn-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    padding: 14px 35px;
    border: none;
    border-radius: 12px;
    font-family: 'Cairo', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #1e40af 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}

.btn-secondary {
    background: var(--card-bg-alt);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    transform: translateY(-2px);
}

.btn-add {
    background: linear-gradient(135deg, var(--success-green) 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

/* Results Section */
.results-section {
    display: none;
}

.results-section.show {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Summary Cards */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: linear-gradient(135deg, var(--card-bg) 0%, var(--card-bg-alt) 100%);
    border-radius: 16px;
    padding: 25px;
    text-align: center;
    box-shadow: var(--shadow);
    border-right: 5px solid var(--primary-blue);
}

.summary-card.success {
    border-right-color: var(--success-green);
}

.summary-card.warning {
    border-right-color: var(--danger-red);
}

.summary-card-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.summary-card-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.summary-card-label {
    font-size: 1rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Visual Bars */
.bars-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.bar-wrapper {
    background: var(--card-bg-alt);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid var(--border-color);
}

.bar-label {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bar-label span {
    font-size: 0.9rem;
    color: var(--text-light);
}

.bar {
    height: 50px;
    background: var(--border-color);
    border-radius: 8px;
    display: flex;
    overflow: hidden;
    position: relative;
}

.bar-segment {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    min-width: 30px;
    position: relative;
    overflow: hidden;
}

.bar-segment.used {
    background: linear-gradient(135deg, var(--success-green) 0%, #059669 100%);
}

.bar-segment.waste {
    background: linear-gradient(135deg, var(--danger-red) 0%, #dc2626 100%);
}

.bar-segment:hover {
    filter: brightness(1.1);
    z-index: 1;
}

/* Info Box */
.info-box {
    background: linear-gradient(135deg, #3b82f615 0%, #2563eb05 100%);
    border: 1px solid #3b82f630;
    border-radius: 12px;
    padding: 20px;
    margin-top: 30px;
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.info-box-icon {
    font-size: 1.5rem;
    background: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.info-content h4 {
    color: var(--primary-blue);
    margin-bottom: 5px;
    font-weight: 700;
}

.info-content p {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header {
        padding: 25px 15px;
    }

    .card {
        padding: 20px;
    }

    .input-grid {
        grid-template-columns: 1fr;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .btn-group {
        flex-direction: column;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .bar-segment {
        font-size: 0.75rem;
        min-width: 25px;
    }

    thead th,
    tbody td {
        padding: 10px 8px;
        font-size: 0.9rem;
    }

    tbody td input {
        padding: 8px 10px;
        font-size: 0.9rem;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.1rem;
}

/* Loading Animation */
.loading {
    display: none;
    text-align: center;
    padding: 30px;
}

.loading.show {
    display: block;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Tooltip */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    right: 50%;
    transform: translateX(50%);
    background: var(--text-dark);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 10px);
}