body {
    font-family: Arial, sans-serif;
    margin: 20px;
    background-color: #f5f5f5;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
}

.total-box {
    background: #4CAF50;
    color: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
}

.add-form {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 2px solid #ddd;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    align-items: center;
}

.form-row label {
    font-weight: bold;
    min-width: 80px;
}

.form-row input, .form-row select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-row input[type="text"] {
    flex: 2;
}

.form-row select {
    flex: 1;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.checkbox-item input[type="checkbox"] {
    transform: scale(1.2);
}

.checkbox-item label {
    flex: 1;
    font-weight: normal;
    margin: 0;
    min-width: auto;
}

.amount-input {
    width: 60px !important;
    padding: 5px !important;
}

.button-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 15px 0;
    justify-content: center;
}

.button-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-primary {
    background: #2196F3;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

.btn-secondary {
    background: #666;
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-import {
    background: #4CAF50;
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-info {
    background: #2196F3;
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-warning {
    background: #FF5722;
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-report {
    background: #FF9800;
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-export {
    background: #9C27B0;
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-import-backup {
    background: #607D8B;
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-danger {
    background: #f44336;
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-primary:hover, .btn-secondary:hover, .btn-import:hover,
.btn-info:hover, .btn-warning:hover, .btn-report:hover,
.btn-export:hover, .btn-import-backup:hover, .btn-danger:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .button-groups {
        flex-direction: column;
        align-items: center;
    }

    .button-group {
        flex-wrap: wrap;
        justify-content: center;
    }
}

button {
    background: #2196F3;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

button:hover {
    background: #1976D2;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

th {
    background: #f2f2f2;
    font-weight: bold;
}

tr:nth-child(even) {
    background: #f9f9f9;
}

.delete-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.delete-btn:hover {
    background: #d32f2f;
}

.summary {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.summary-item {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.summary-item h3 {
    margin: 0 0 10px 0;
    color: #1976d2;
}

.print-report {
    display: none;
    background: white;
    padding: 20px;
    font-family: 'Times New Roman', serif;
    font-size: 12px;
}

.print-report h1 {
    text-align: center;
    border-bottom: 2px solid #333;
    padding-bottom: 5px;
    margin-bottom: 15px;
    font-size: 18px;
}

.print-report .summary-section {
    margin-bottom: 15px;
    border: 1px solid #333;
    padding: 10px;
}

.print-report .summary-grid {
    display: inline-block;
    width: 100%;
}

.print-report .summary-line {
    display: inline-block;
    margin-right: 20px;
    font-weight: bold;
}

.print-report table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 11px;
}

.print-report th,
.print-report td {
    border: 1px solid #333;
    padding: 4px;
    text-align: left;
}

.print-report th {
    background: #f0f0f0;
    font-weight: bold;
    font-size: 12px;
}

.checkbox-column {
    width: 25px;
    text-align: center;
}

.name-column {
    width: 20%;
    min-width: 120px;
}

.book-column {
    width: auto;
    text-align: center;
    min-width: 50px;
}

.delivered-column {
    width: 50px;
    text-align: center;
}

.print-controls {
    text-align: center;
    margin: 20px 0;
    padding: 20px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #f5f5f5;
}

.print-controls button {
    margin: 0 10px;
    padding: 10px 20px;
    font-size: 16px;
}

@media print {
    .container { box-shadow: none; }
    .print-controls { display: none; }
    body { margin: 0; background: white; }
    .print-report { display: block !important; }
    .main-interface { display: none !important; }
}

input[type="file"] {
    display: none;
}

.summary-item .count {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

.success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4CAF50;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 9999;
    font-weight: bold;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    max-width: 300px;
    word-wrap: break-word;
}

.success-message.show {
    opacity: 1;
    transform: translateX(0);
}

#csvFileInput {
    display: inline-block !important;
}

/* Login Screen Styles */
.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 28px;
}

.login-container h2 {
    color: #666;
    margin-bottom: 30px;
    font-size: 20px;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.password-wrapper {
    position: relative;
    width: 100%;
    display: block;
}

.password-wrapper input {
    width: 100%;
    padding-right: 50px !important;
    display: block;
}

.password-toggle {
    position: absolute !important;
    right: 8px !important;
    top: 12px !important;
    background: none !important;
    border: none !important;
    cursor: pointer;
    font-size: 20px;
    padding: 4px 8px;
    line-height: 1;
    color: #666;
    transition: color 0.2s;
    margin: 0 !important;
    height: 32px !important;
    width: 32px !important;
    min-width: unset !important;
    max-width: unset !important;
    z-index: 10;
    display: inline-block !important;
}

.password-toggle:hover {
    color: #333;
}

.password-toggle:active {
    transform: scale(0.95);
}

.login-error {
    background: #ffebee;
    color: #c62828;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    display: none;
    font-size: 14px;
}

.login-error.show {
    display: block;
}

#loginForm button[type="submit"],
#loginForm button[type="button"]:not(.password-toggle) {
    width: 100%;
    margin-bottom: 10px;
}

/* Hide offline-only buttons by default */
.offline-only {
    display: none !important;
}
