/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e9f2 100%);
    min-height: 100vh;
    color: #1e293b;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    color: white;
    padding: 30px 40px;
    border-radius: 24px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.3);
    position: relative;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo i {
    font-size: 2rem;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.header-subtitle {
    opacity: 0.9;
    font-size: 1.1rem;
    margin-top: 10px;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 12px;
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-3px);
}

.help-button {
    position: absolute;
    top: 30px;
    right: 40px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Modal Styles */
.modal {
    display: block;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 25px 60px rgba(99, 102, 241, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close {
    color: #94a3b8;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #6366f1;
}

.welcome-features {
    margin: 20px 0;
}

.feature-item {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding: 15px;
    background: #f8fafc;
    border-radius: 12px;
    border-left: 4px solid #6366f1;
}

.feature-icon {
    font-size: 1.5em;
    margin-right: 15px;
    min-width: 30px;
}

.tour-btn, .skip-btn {
    margin: 10px 5px;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tour-btn {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.skip-btn {
    background: #64748b;
    color: white;
}

.tour-btn:hover, .skip-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

/* Tooltip Styles */
.tooltip {
    position: absolute;
    z-index: 1000;
    background: #1e293b;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    max-width: 250px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
}

.tooltip.show {
    opacity: 1;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
    position: relative;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
    margin-bottom: 20px;
}

.help-button {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.help-button:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
}

.help-icon {
    margin-right: 8px;
}

/* Section Headers */
.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
}

.section-header .help-icon {
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.section-header .help-icon:hover {
    background: #1976d2;
    color: white;
    transform: scale(1.1);
}

/* Instruction Boxes */
.instruction-box {
    background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
    border: 1px solid #bbdefb;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 25px;
    border-left: 5px solid #2196f3;
}

.instruction-box p {
    margin: 0;
    color: #1565c0;
    font-weight: 500;
}

/* Property Explanations */
.property-explanation {
    background: rgba(102, 126, 234, 0.1);
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: 10px;
    border-left: 3px solid #667eea;
}

.property-explanation small {
    color: #4a5568;
    font-style: italic;
}

/* Section styling */
section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

section:hover {
    transform: translateY(-5px);
}

section h2 {
    color: #4a5568;
    margin-bottom: 25px;
    font-size: 2em;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

/* Transaction States */
.states-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.state-diagram {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.state {
    flex: 1;
    min-width: 180px;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    background: #f8f9fa;
    border: 3px solid #dee2e6;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.state.active {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border-color: #28a745;
    animation: pulse 2s infinite;
}

.state.partially-committed {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: white;
    border-color: #ffc107;
}

.state.committed {
    background: linear-gradient(135deg, #007bff, #6610f2);
    color: white;
    border-color: #007bff;
}

.state.failed {
    background: linear-gradient(135deg, #dc3545, #e83e8c);
    color: white;
    border-color: #dc3545;
}

.state.aborted {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
    border-color: #6c757d;
}

.state-name {
    font-size: 1.2em;
    font-weight: bold;
    display: block;
    margin-bottom: 10px;
}

.state-description {
    font-size: 0.9em;
    opacity: 0.9;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.state.animating {
    animation: slideIn 0.5s ease-out;
}

/* Controls */
.controls {
    text-align: center;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Enhanced Button Styles */
button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Button Variants */
.btn-success {
    background: linear-gradient(135deg, #28a745, #20c997);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.btn-success:hover {
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #e83e8c);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: #212529;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
}

.btn-warning:hover {
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.btn-secondary:hover {
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

.btn-primary {
    background: linear-gradient(135deg, #007bff, #0056b3);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

/* Progress Indicators */
.progress-indicator {
    text-align: center;
    margin-top: 20px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
}

.progress-bar {
    background: #e9ecef;
    height: 8px;
    border-radius: 4px;
    margin: 10px 0;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.3s ease;
    animation: progressPulse 2s infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.progress-text {
    font-weight: 500;
    color: #4a5568;
    margin-top: 10px;
    display: block;
}

/* Demo Status */
.demo-status {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 15px;
    margin-top: 15px;
}

.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.status-icon {
    font-size: 1.2em;
    margin-right: 10px;
    animation: spin 2s linear infinite;
}

.status-text {
    font-weight: 500;
    color: #495057;
}

/* ACID Properties */
.acid-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.acid-property {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    border-left: 5px solid #667eea;
}

.acid-property h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.4em;
}

.acid-property p {
    color: #6c757d;
    margin-bottom: 20px;
    font-style: italic;
}

.demo-area {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #e9ecef;
}

/* Bank Account Demo */
.bank-account {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
}

.account {
    text-align: center;
    padding: 15px;
    background: #e3f2fd;
    border-radius: 8px;
    min-width: 120px;
}

.account h4 {
    margin-bottom: 10px;
    color: #1976d2;
}

.balance {
    font-size: 1.5em;
    font-weight: bold;
    color: #2e7d32;
    padding: 10px;
    background: white;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.balance.updating {
    animation: balanceUpdate 1s ease-in-out;
}

@keyframes balanceUpdate {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); background-color: #fff3cd; }
}

/* Consistency Demo */
.constraint-check {
    text-align: center;
}

.rule {
    background: #d4edda;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    border-left: 4px solid #28a745;
    font-weight: 500;
}

.test-case {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.test-case input {
    padding: 8px 12px;
    border: 2px solid #dee2e6;
    border-radius: 5px;
    font-size: 1em;
}

#consistency-result {
    padding: 10px;
    border-radius: 5px;
    font-weight: 500;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#consistency-result.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#consistency-result.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Isolation Demo */
.concurrent-transactions {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
}

.transaction {
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    min-width: 130px;
}

#tx1 {
    background: #e3f2fd;
    border: 2px solid #2196f3;
}

#tx2 {
    background: #f3e5f5;
    border: 2px solid #9c27b0;
}

.tx-status {
    padding: 8px;
    margin-top: 10px;
    border-radius: 5px;
    background: white;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tx-status.running {
    background: #fff3cd;
    color: #856404;
    animation: pulse 1.5s infinite;
}

.tx-status.completed {
    background: #d4edda;
    color: #155724;
}

/* Durability Demo */
.system-status {
    text-align: center;
}

.status-indicator {
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
    font-size: 1.2em;
    font-weight: bold;
    transition: all 0.3s ease;
}

.status-indicator.online {
    background: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
}

.status-indicator.crashed {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #dc3545;
    animation: shake 0.5s ease-in-out;
}

.status-indicator.recovered {
    background: #cce5ff;
    color: #004085;
    border: 2px solid #007bff;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.transaction-log {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 5px;
    padding: 10px;
    min-height: 60px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    text-align: left;
    max-height: 150px;
    overflow-y: auto;
}

.log-entry {
    padding: 2px 0;
    border-bottom: 1px solid #eee;
}

.log-entry:last-child {
    border-bottom: none;
}

/* Dirty Read Simulation */
.scenario-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    margin-bottom: 20px;
}

.transactions-panel {
    display: flex;
    gap: 20px;
}

.transaction-window {
    flex: 1;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    border: 3px solid #dee2e6;
}

#transaction-1 {
    border-color: #dc3545;
}

#transaction-2 {
    border-color: #007bff;
}

.transaction-window h3 {
    color: #495057;
    margin-bottom: 15px;
}

.tx-steps {
    list-style: none;
}

.step {
    padding: 10px;
    margin-bottom: 8px;
    background: white;
    border-radius: 5px;
    border-left: 4px solid #dee2e6;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.step.active {
    border-left-color: #ffc107;
    background: #fff3cd;
    animation: highlight 1s ease-in-out;
}

.step.completed {
    border-left-color: #28a745;
    background: #d4edda;
}

.step.problem {
    border-left-color: #dc3545;
    background: #f8d7da;
    color: #721c24;
}

@keyframes highlight {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.data-view {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
}

.data-view h4 {
    margin-bottom: 15px;
    color: #495057;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

th {
    background: #667eea;
    color: white;
    font-weight: 600;
}

tr:hover {
    background: #f8f9fa;
}

#balance-value {
    font-weight: bold;
    font-size: 1.1em;
    transition: all 0.3s ease;
}

#balance-value.dirty {
    color: #dc3545;
    background: #f8d7da;
}

#balance-value.clean {
    color: #28a745;
    background: #d4edda;
}

#balance-status {
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    text-align: center;
}

#balance-status.uncommitted {
    background: #fff3cd;
    color: #856404;
}

#balance-status.committed {
    background: #d4edda;
    color: #155724;
}

/* Privilege Management */
.privilege-container {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 25px;
}

.users-panel {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.users-panel h3 {
    margin-bottom: 15px;
    color: #495057;
}

.user {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

.user:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.user-name {
    font-weight: bold;
    color: #495057;
    margin-bottom: 5px;
}

.user-privileges {
    font-size: 0.9em;
    color: #6c757d;
    background: #e9ecef;
    padding: 5px 10px;
    border-radius: 4px;
}

.sample-data {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.sample-data h3 {
    margin-bottom: 15px;
    color: #495057;
}

.privilege-controls {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.privilege-controls h3 {
    margin-bottom: 15px;
    color: #495057;
}

.grant-revoke-section {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.control-group {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.control-group label {
    font-weight: 500;
    min-width: 80px;
}

select, input {
    padding: 8px 12px;
    border: 2px solid #dee2e6;
    border-radius: 5px;
    font-size: 1em;
}

select:focus, input:focus {
    outline: none;
    border-color: #667eea;
}

.test-operations {
    background: white;
    padding: 15px;
    border-radius: 8px;
}

.test-operations h4 {
    margin-bottom: 10px;
    color: #495057;
}

.operation-test {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

#operation-result {
    padding: 10px;
    border-radius: 5px;
    font-weight: 500;
    min-height: 40px;
    display: flex;
    align-items: center;
}

#operation-result.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#operation-result.denied {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Enhanced Responsive Design */

/* Large screens (1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
        padding: 20px;
    }
    
    .acid-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .scenario-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .privilege-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Medium screens (992px to 1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
    .container {
        max-width: 1200px;
        padding: 18px;
    }
    
    .modal-content {
        margin: 8% auto;
        width: 85%;
    }
}

/* Small screens (768px to 991px) */
@media (max-width: 991px) and (min-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 90%;
        padding: 25px;
    }
    
    .state-diagram {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }
    
    .state {
        flex: 1;
        min-width: 180px;
        max-width: 250px;
    }
    
    .acid-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .scenario-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    header h1 {
        font-size: 2.2em;
    }
    
    button {
        padding: 12px 20px;
        font-size: 0.9em;
    }
}

/* Mobile screens (576px to 767px) */
@media (max-width: 767px) and (min-width: 576px) {
    .container {
        padding: 12px;
    }
    
    .modal-content {
        margin: 5% auto;
        width: 95%;
        padding: 20px;
        border-radius: 8px;
    }
    
    .welcome-features {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .feature-item {
        flex-direction: row;
        text-align: left;
        padding: 12px;
    }
    
    .feature-icon {
        margin-right: 10px;
        font-size: 1.5em;
    }
    
    .state-diagram {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        padding: 15px;
    }
    
    .state {
        width: 100%;
        max-width: 300px;
        min-width: 180px;
        padding: 10px 15px;
        font-size: 0.9em;
    }
    
    .acid-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .acid-property {
        padding: 15px;
    }
    
    .scenario-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .transactions-panel {
        flex-direction: column;
        gap: 15px;
    }
    
    .privilege-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .bank-account {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .account-info {
        text-align: center;
        min-width: auto;
    }
    
    .concurrent-transactions {
        flex-direction: column;
        gap: 12px;
    }
    
    .transaction {
        padding: 12px;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    button {
        width: 100%;
        max-width: 350px;
        margin: 0 auto;
        padding: 12px 16px;
        font-size: 0.9em;
        min-height: 44px;
    }
    
    .help-button {
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 1000;
    }
    
    header h1 {
        font-size: 1.8em;
        margin-bottom: 8px;
    }
    
    header p {
        font-size: 0.9em;
    }
    
    .section h2 {
        font-size: 1.3em;
    }
    
    .panel {
        padding: 15px;
        margin: 10px 0;
    }
}

/* Extra small screens (up to 575px) - Mobile phones */
@media (max-width: 575px) {
    body {
        font-size: 14px;
        padding: 5px;
    }
    
    .container {
        padding: 8px;
        margin: 0;
    }
    
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        margin: 2% auto;
        width: 98%;
        max-width: none;
        padding: 15px;
        border-radius: 6px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-content h2 {
        font-size: 1.3em;
        margin-bottom: 10px;
    }
    
    .welcome-features {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .feature-item {
        flex-direction: column;
        text-align: center;
        padding: 10px;
    }
    
    .feature-icon {
        margin-right: 0;
        margin-bottom: 8px;
        font-size: 1.8em;
    }
    
    .tour-btn, .skip-btn {
        width: 100%;
        padding: 12px;
        font-size: 0.9em;
        margin: 5px 0;
    }
    
    header {
        padding: 12px;
        text-align: center;
    }
    
    header h1 {
        font-size: 1.4em;
        margin-bottom: 6px;
        line-height: 1.2;
    }
    
    header p {
        font-size: 0.85em;
        margin-bottom: 10px;
    }
    
    .help-button {
        position: fixed;
        bottom: 15px;
        right: 15px;
        padding: 10px;
        font-size: 0.8em;
        z-index: 1000;
    }
    
    .section {
        margin: 10px 0;
    }
    
    .section h2 {
        font-size: 1.2em;
        margin-bottom: 10px;
    }
    
    .panel {
        padding: 12px;
        margin: 8px 0;
        border-radius: 6px;
    }
    
    .state-diagram {
        flex-direction: column;
        gap: 8px;
        padding: 10px;
    }
    
    .state {
        width: 100%;
        max-width: 250px;
        min-width: 150px;
        padding: 8px 12px;
        font-size: 0.8em;
        margin: 0 auto;
    }
    
    .acid-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .acid-property {
        padding: 12px;
    }
    
    .acid-property h3 {
        font-size: 1em;
        margin-bottom: 6px;
    }
    
    .scenario-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .bank-account {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .account-info {
        text-align: center;
        padding: 10px;
        font-size: 0.85em;
    }
    
    .concurrent-transactions {
        flex-direction: column;
        gap: 8px;
    }
    
    .transaction {
        padding: 10px;
        font-size: 0.85em;
    }
    
    .controls {
        flex-direction: column;
        gap: 8px;
    }
    
    button {
        width: 100%;
        padding: 10px 12px;
        font-size: 0.85em;
        min-height: 44px;
        border-radius: 6px;
    }
    
    .privilege-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .privilege-card {
        padding: 10px;
    }
    
    .user-card {
        margin: 5px 0;
        padding: 8px;
    }
    
    /* Make tables more mobile-friendly */
    table {
        font-size: 0.8em;
        width: 100%;
    }
    
    th, td {
        padding: 6px 4px;
        font-size: 0.75em;
    }
    
    /* Better spacing for mobile */
    .status {
        padding: 4px 8px;
        font-size: 0.75em;
    }
    
    .log-entry {
        padding: 8px;
        font-size: 0.8em;
    }
    
    header p {
        font-size: 0.9em;
    }
    
    .help-button {
        position: static;
        margin-top: 10px;
        width: 100%;
        max-width: 200px;
    }
    
    section {
        padding: 12px;
        margin: 8px 0;
    }
    
    .section-header h2 {
        font-size: 1.3em;
        margin-bottom: 8px;
    }
    
    .state-diagram {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .state {
        width: 100%;
        min-width: 150px;
        max-width: 280px;
        padding: 12px 8px;
    }
    
    .state-name {
        font-size: 0.9em;
    }
    
    .state-description {
        font-size: 0.8em;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    button {
        width: 100%;
        padding: 10px 12px;
        font-size: 0.8em;
        border-radius: 6px;
    }
    
    .instruction-box {
        padding: 12px;
        font-size: 0.9em;
    }
    
    .test-case {
        flex-direction: column;
        padding: 12px;
    }
    
    .operation-test {
        flex-direction: column;
        gap: 8px;
    }
    
    .welcome-features {
        margin: 15px 0;
    }
    
    .feature-item {
        flex-direction: column;
        text-align: center;
        padding: 12px;
        margin-bottom: 10px;
    }
    
    .feature-icon {
        margin: 0 0 8px 0;
        font-size: 1.2em;
    }
    
    .tour-btn, .skip-btn {
        width: 100%;
        margin: 5px 0;
        padding: 10px 16px;
        font-size: 0.9em;
    }
    
    /* Make tables more mobile-friendly */
    table {
        font-size: 0.8em;
    }
    
    th, td {
        padding: 6px 8px;
    }
    
    /* Improve touch targets */
    .help-icon {
        padding: 8px;
        font-size: 1.1em;
        cursor: pointer;
    }
    
    /* Better spacing for mobile */
    .acid-property {
        margin-bottom: 15px;
    }
    
    .scenario {
        margin-bottom: 15px;
    }
}

/* Landscape orientation adjustments for mobile devices */
@media (max-height: 500px) and (orientation: landscape) {
    .modal-content {
        margin: 2% auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    header {
        padding: 8px 15px;
    }
    
    header h1 {
        font-size: 1.4em;
        margin-bottom: 5px;
    }
    
    section {
        padding: 8px;
        margin: 5px 0;
    }
    
    .state-diagram {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .state {
        flex: 1;
        min-width: 120px;
        max-width: 180px;
        padding: 8px;
    }
    
    .controls {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    button {
        flex: 1;
        min-width: 120px;
        max-width: 200px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .state {
        border: 2px solid #000;
    }
    
    button {
        border: 2px solid #000;
    }
    
    .modal-content {
        border: 2px solid #000;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Animations and transitions */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Loading spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 10px;
}

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