:root {
    --primary-color: #000000;
    --secondary-color: #666666;
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
    --text-color: #333333;
    --input-bg: #fdfdfd;
    --input-border: #e0e0e0;
    --accent-red: #ff4d4d;
    --transition-speed: 0.3s;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body.dark {
    --primary-color: #ffffff;
    --secondary-color: #aaaaaa;
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #eeeeee;
    --input-bg: #2d2d2d;
    --input-border: #444444;
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

body {
    background: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Loading Animation */
#loding {
    height: 100vh;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

#aaa {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 20px;
}

#aaa::after {
    content: '%';
}

.jjj {
    height: 8px;
    width: 200px;
    background: var(--input-border);
    border-radius: 10px;
    overflow: hidden;
}

#jjj {
    height: 100%;
    width: 0%;
    background: var(--primary-color);
    animation: loadingProgress 3s linear forwards;
}

@keyframes loadingProgress {
    0% {
        width: 0%;
    }

    100% {
        width: 100%;
    }
}

.loading-hidden {
    opacity: 0 !important;
    pointer-events: none;
}

/* Main Layout */
.crud {
    width: 95%;
    max-width: 1000px;
    margin: 40px auto;
    padding: 20px;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    text-transform: uppercase;
}

.head h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 2px;
}

.head p {
    color: var(--secondary-color);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Theme Switcher */
#them {
    width: 50px;
    height: 26px;
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: 20px;
    cursor: pointer;
    position: relative;
    padding: 2px;
}

#them::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

body.dark #them::before {
    transform: translate(22px, -50%);
}

/* Form Styling */
.inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
}

input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05);
    background: var(--card-bg);
}

body.dark input:focus {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05);
}

.price {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.price input {
    flex: 1 1 150px;
}

#total {
    flex: 1 1 100%;
    background: var(--accent-red);
    color: white;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    font-weight: bold;
}

#total::before {
    content: 'Total: ';
}

/* Buttons */
button {
    cursor: pointer;
    padding: 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary-color);
    color: var(--bg-color);
    font-weight: 600;
    text-transform: uppercase;
    transition: all 0.3s;
    letter-spacing: 1px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    opacity: 0.9;
}

button:active {
    transform: translateY(0);
}

.searchBlock {
    margin-bottom: 20px;
}

.btnSearch {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btnSearch button {
    flex: 1;
}

#deleteAll button {
    width: 100%;
    background: var(--accent-red);
    margin-bottom: 20px;
}

/* Table Responsive Container */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
    background: var(--input-bg);
}

table th {
    background: var(--primary-color);
    color: var(--bg-color);
    padding: 15px;
    font-size: 0.85rem;
    text-transform: uppercase;
    text-align: left;
}

table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--input-border);
    font-size: 0.95rem;
}

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

table tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

body.dark table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

table button {
    padding: 6px 12px;
    font-size: 0.8rem;
    text-transform: none;
}

/* Responsive Breakpoints */
@media (max-width: 600px) {
    .crud {
        width: 100%;
        margin: 0;
        border-radius: 0;
        padding: 15px;
        box-shadow: none;
    }

    .head h2 {
        font-size: 1.5rem;
    }

    .price input {
        flex: 1 1 calc(50% - 10px);
    }

    #aaa {
        font-size: 3rem;
    }
}

@media (max-width: 400px) {
    .price input {
        flex: 1 1 100%;
    }
}