:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --background-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-color: #212529;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --border-radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

@keyframes gradient-animation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

body {
    font-family: 'Roboto', sans-serif;
    color: var(--text-color);
    margin: 0;
    line-height: 1.6;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradient-animation 15s ease infinite;
    background-attachment: fixed;
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0;
    text-align: center;
    width: 100%;
    box-shadow: var(--shadow);
}

header h1 {
    margin: 0;
    font-weight: 500;
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

#summary-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    width: 100%;
    max-width: 1200px;
    margin-bottom: 40px;
}

#summary-dashboard .summary-card:nth-child(1) { animation-delay: 0.1s; }
#summary-dashboard .summary-card:nth-child(2) { animation-delay: 0.2s; }
#summary-dashboard .summary-card:nth-child(3) { animation-delay: 0.3s; }

#material-form { animation-delay: 0.4s; }
.controls { animation-delay: 0.5s; }
.table-container { animation-delay: 0.6s; }

.summary-card {
    background: var(--surface-color);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    border-top: 4px solid var(--primary-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.card-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.summary-card h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--primary-color);
    font-weight: 500;
}

.summary-card p {
    font-size: 1.1em;
    margin: 10px 0 0;
    color: var(--text-color);
}

.summary-card span {
    font-weight: 700;
    font-size: 1.5em;
    color: var(--text-color);
}

#material-form {
    padding: 40px;
    width: 100%;
    max-width: 800px;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    #material-form {
        grid-template-columns: 1fr 1fr;
        gap: 25px;
    }
}

.form-group {
    margin-bottom: 0;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

button.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--secondary-color);
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius);
    box-sizing: border-box;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

button {
    padding: 12px 20px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--border-radius);
    color: white;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

button[type="submit"] {
    background-color: var(--primary-color);
}

button[type="submit"]:hover {
    background-color: #0069d9;
    transform: translateY(-2px);
}

.controls {
    margin: 30px 0;
    display: flex;
    gap: 15px;
}

#download-csv, #clear-data {
    width: auto;
    padding: 10px 25px;
}

#download-csv {
    background-color: var(--success-color);
}

#download-csv:hover {
    background-color: #218838;
}

#download-pdf {
    background-color: #ffc107; /* Amber */
}

#download-pdf:hover {
    background-color: #e0a800;
}

#share-report {
    background-color: #17a2b8; /* Info Blue */
}

#share-report:hover {
    background-color: #138496;
}

#clear-data {
    background-color: var(--danger-color);
}

#clear-data:hover {
    background-color: #c82333;
}

.table-container {
    padding: 30px;
    box-sizing: border-box;
}

h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--primary-color);
    text-align: left;
    font-weight: 500;
}

#data-table {
    width: 100%;
    border-collapse: collapse;
}

#data-table th, #data-table td {
    border-bottom: 1px solid #dee2e6;
    padding: 15px;
    text-align: left;
}

#data-table thead th {
    background-color: var(--background-color);
    color: var(--secondary-color);
    font-weight: 500;
    border-top: 1px solid #dee2e6;
}

#data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

#data-table tbody tr.new-row-animation {
    animation: new-row-animation 0.8s ease-out;
}

/* Splash Screen Styles */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a2e;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
    transition: opacity 0.8s ease-out, visibility 0.8s ease-out;
}

#splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

#splash-screen h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid #fff;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
