﻿/* ===== CSS Variables ===== */
:root {
    --primary: #10b981;
    --primary-dark: #059669;
    --primary-light: #d1fae5;
    --secondary: #1f2937;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --light-bg: #f9fafb;
    --border-color: #e5e7eb;
    --text-dark: #111827;
    --text-light: #6b7280;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* ===== Reset and Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background-color: var(--light-bg);
    color: var(--text-dark);
    line-height: 1.6;
    font-size: 16px;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    color: var(--text-light);
    margin-bottom: 1rem;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

    a:hover {
        color: var(--primary-dark);
    }

/* ===== Top Navigation Bar ===== */
.topbar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.brand {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

    .brand::before {
        content: '🛒';
        font-size: 2rem;
    }

.nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    position: relative;
}

    .nav a::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 0;
        height: 2px;
        background-color: rgba(255, 255, 255, 0.8);
        transition: width 0.3s ease;
    }

    .nav a:hover {
        color: #ffffff;
        background-color: rgba(255, 255, 255, 0.1);
    }

    .nav a:hover::after {
        width: 100%;
    }

/* ===== Container ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: calc(100vh - 160px);
}

/* ===== Forms & Buttons ===== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background-color: white;
}

    input[type="text"]:focus,
    input[type="email"]:focus,
    input[type="password"]:focus,
    input[type="number"]:focus,
    textarea:focus,
    select:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
    }

button,
input[type="submit"],
input[type="button"],
.btn {
    padding: 0.75rem 1.5rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

    button:hover,
    input[type="submit"]:hover,
    input[type="button"]:hover,
    .btn:hover {
        background-color: var(--primary-dark);
        box-shadow: var(--shadow-lg);
        transform: translateY(-2px);
    }

    button:active,
    input[type="submit"]:active,
    input[type="button"]:active,
    .btn:active {
        transform: translateY(0);
    }

/* Button Variants */
.btn-login {
    width: 100%;
    padding: 0.75rem;
    margin-top: 1rem;
}

.btn-secondary {
    background-color: var(--secondary);
}

    .btn-secondary:hover {
        background-color: #111827;
    }

.btn-danger {
    background-color: var(--danger);
}

    .btn-danger:hover {
        background-color: #dc2626;
    }

/* ===== Forms ===== */
.form-group {
    margin-bottom: 1.5rem;
}

    .form-group label {
        display: block;
        margin-bottom: 0.5rem;
        font-weight: 500;
        color: var(--text-dark);
    }

.form-row {
    margin-bottom: 1rem;
}

    .form-row label {
        display: block;
        margin-bottom: 0.5rem;
        font-weight: 500;
        color: var(--text-dark);
    }

.input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
}

    .input:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
    }

/* ===== Login Container ===== */
.login-container {
    max-width: 400px;
    margin: 4rem auto;
    background: white;
    padding: 2.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
}

    .login-container h2 {
        text-align: center;
        margin-bottom: 2rem;
        color: var(--primary);
    }

.error-message {
    color: var(--danger);
    font-weight: 500;
    padding: 0.75rem 1rem;
    background-color: #fee2e2;
    border-radius: 0.5rem;
    margin-top: 1rem;
    display: block;
}

.success-message {
    color: var(--success);
    font-weight: 500;
    padding: 0.75rem 1rem;
    background-color: #d1fae5;
    border-radius: 0.5rem;
    margin-top: 1rem;
    display: block;
}

/* ===== Tables ===== */
.table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin: 1.5rem 0;
}

    .table thead {
        background-color: var(--primary);
        color: white;
    }

    .table thead tr {
        display: table-row;
    }

    .table th {
        padding: 1rem;
        text-align: left;
        font-weight: 600;
        white-space: nowrap;
    }

    .table td {
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
        word-wrap: break-word;
        word-break: break-word;
    }

    .table tbody {
        display: table-row-group;
    }

    .table tbody tr {
        display: table-row;
        transition: background-color 0.2s ease;
    }

    .table tbody tr:hover {
        background-color: var(--primary-light);
    }

    .table tbody tr:last-child td {
        border-bottom: none;
    }

/* GridView specific styling */
table[cellspacing="0"] {
    width: 100% !important;
    border-collapse: collapse;
}

    table[cellspacing="0"] td {
        padding: 1rem !important;
        border-bottom: 1px solid var(--border-color) !important;
    }

    table[cellspacing="0"] th {
        background-color: var(--primary) !important;
        color: white !important;
        padding: 1rem !important;
        font-weight: 600 !important;
    }

    table[cellspacing="0"] tbody tr:hover {
        background-color: var(--primary-light) !important;
    }

/* Currency column styling - prevent text wrapping */
.currency-cell {
    white-space: nowrap !important;
    text-align: right;
}


/* Transaction Items Table */
.transaction-items {
    width: 100%;
    margin: 1rem 0;
    border-collapse: collapse;
    background-color: #f3f4f6;
    border-radius: 0.5rem;
}

    .transaction-items th {
        background-color: var(--primary);
        color: white;
        padding: 0.75rem;
        font-weight: 600;
        text-align: left;
    }

    .transaction-items td {
        padding: 0.75rem;
        border-bottom: 1px solid var(--border-color);
    }

    .transaction-items tbody tr:hover {
        background-color: white;
    }

    .transaction-items tbody tr:last-child td {
        border-bottom: none;
    }

/* Ensure all text is visible */
.table-responsive {
    overflow-x: auto;
}

.table-responsive .table {
    min-width: 500px;
}

/* ===== Data Display ===== */
.amount {
    font-weight: 600;
    color: var(--primary);
}

.product-name {
    font-weight: 500;
    color: var(--text-dark);
}

.price {
    text-align: right;
    font-weight: 500;
}

.quantity {
    text-align: center;
    font-weight: 500;
}

/* ===== Info Display ===== */
.info-section {
    background-color: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin: 1.5rem 0;
    box-shadow: var(--shadow);
}

    .info-section h3 {
        color: var(--primary);
        margin-bottom: 1rem;
        border-bottom: 2px solid var(--primary-light);
        padding-bottom: 0.5rem;
    }

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

    .info-row:last-child {
        border-bottom: none;
    }

    .info-row label {
        font-weight: 600;
        color: var(--text-dark);
    }

    .info-row value {
        color: var(--text-light);
    }

/* ===== Cards ===== */
.card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

    .card:hover {
        box-shadow: var(--shadow-lg);
        transform: translateY(-2px);
    }

    .card h3 {
        color: var(--primary);
        margin-bottom: 1rem;
    }

/* ===== Grid ===== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

/* ===== Status Labels ===== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

/* ===== Footer ===== */
.footer {
    background: linear-gradient(135deg, var(--secondary) 0%, #0f172a 100%);
    color: #9ca3af;
    text-align: center;
    padding: 2rem 1rem;
    font-size: 0.9rem;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
}

    .footer p {
        color: #9ca3af;
        margin-bottom: 0;
    }

/* ===== Utilities ===== */
.text-center {
    text-align: center;
}

.text-primary {
    color: var(--primary);
}

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.rounded {
    border-radius: 0.5rem;
}

.shadow {
    box-shadow: var(--shadow);
}

.shadow-lg {
    box-shadow: var(--shadow-lg);
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .topbar {
        flex-direction: column;
        gap: 1rem;
    }

    .nav {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }

    .nav a {
        width: 100%;
    }

    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .login-container {
        margin: 2rem auto;
        padding: 1.5rem;
    }
}
