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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #dc2626 0%, #000000 100%);
    background-attachment: fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Touch-friendly improvements */
button, input, select, textarea {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    font-family: inherit;
}

button {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

input, textarea {
    -webkit-tap-highlight-color: transparent;
}

/* Prevent zoom on focus for iOS */
input[type="text"], 
input[type="password"], 
input[type="email"], 
input[type="time"], 
textarea {
    font-size: 16px;
}

/* Scrollbar styling for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #dc2626;
    border: 1px solid #000;
}

::-webkit-scrollbar-thumb:hover {
    background: #000;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    min-height: 100vh;
    background: white;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: #000;
    color: white;
    padding: 20px 20px 0;
    border-bottom: 3px solid #dc2626;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 24px;
    font-weight: bold;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logout-btn {
    background: #dc2626;
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    min-height: 44px;
    border: 2px solid white;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.logout-btn:hover, .logout-btn:focus {
    background: white;
    color: #dc2626;
    outline: 2px solid #dc2626;
    outline-offset: 2px;
}

.logout-btn:active {
    background: #f5f5f5;
}

/* Open Source Banner */
.open-source-banner {
    background: #dc2626;
    border-top: 2px solid #fff;
    padding: 12px 0;
}

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

.open-source-text {
    font-weight: bold;
    color: white;
    font-size: 14px;
}

.github-badge {
    background: white;
    color: #000;
    text-decoration: none;
    padding: 4px 12px;
    border: 2px solid #000;
    font-weight: bold;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.github-badge:hover {
    background: #000;
    color: white;
}

.demo-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
}

/* Main content */
.main-content {
    flex: 1;
    padding: 20px;
}

/* Messages */
.message {
    padding: 12px 20px;
    margin-bottom: 20px;
    border: 2px solid;
    font-weight: bold;
}

.message.success {
    background: #f0f9ff;
    color: #166534;
    border-color: #166534;
}

.message.error {
    background: #fef2f2;
    color: #dc2626;
    border-color: #dc2626;
}

/* Navigation */
.navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border: 2px solid #000;
}

.nav-btn {
    background: #dc2626;
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    min-height: 44px;
    border: 2px solid #000;
    font-weight: bold;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.nav-btn:hover, .nav-btn:focus {
    background: #000;
    color: white;
    outline: 2px solid #dc2626;
    outline-offset: 2px;
}

.nav-btn:active {
    background: #333;
}

.current-period {
    font-size: 18px;
    font-weight: bold;
    color: #000;
}

/* Schedule grid */
.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.day-column {
    border: 2px solid #000;
    background: white;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.day-header {
    background: #dc2626;
    color: white;
    padding: 12px;
    text-align: center;
    border-bottom: 2px solid #000;
}

.day-header h3 {
    font-size: 16px;
    font-weight: bold;
}

.day-header p {
    font-size: 14px;
    margin-top: 4px;
}

.events-list {
    flex: 1;
    padding: 10px;
    min-height: 200px;
}

.event {
    background: #f8f9fa;
    border: 2px solid #000;
    padding: 8px;
    margin-bottom: 8px;
    position: relative;
}

.event-time {
    font-size: 12px;
    font-weight: bold;
    color: #dc2626;
    margin-bottom: 4px;
}

.event-title {
    font-size: 14px;
    color: #000;
    line-height: 1.3;
}

.delete-form {
    position: absolute;
    top: 4px;
    right: 4px;
}

.delete-btn {
    background: #dc2626;
    color: white;
    border: 1px solid #000;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.delete-btn:hover, .delete-btn:focus {
    background: #000;
    outline: 2px solid #dc2626;
    outline-offset: 2px;
}

.delete-btn:active {
    background: #555;
}

/* Add event form */
.add-event-form {
    padding: 12px;
    background: #f8f9fa;
    border-top: 2px solid #000;
}

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

.form-group input {
    width: 100%;
    padding: 8px;
    border: 2px solid #000;
    background: white;
    font-size: 14px;
}

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

.time-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.time-inputs input {
    flex: 1;
    padding: 6px;
    border: 2px solid #000;
    font-size: 12px;
}

.time-inputs span {
    font-size: 12px;
    font-weight: bold;
}

.add-btn {
    width: 100%;
    background: #000;
    color: white;
    border: 2px solid #dc2626;
    padding: 12px 8px;
    min-height: 44px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.add-btn:hover, .add-btn:focus {
    background: #dc2626;
    color: white;
    outline: 2px solid #000;
    outline-offset: 2px;
}

.add-btn:active {
    background: #b91c1c;
}

/* Authentication pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-box {
    background: white;
    border: 3px solid #000;
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.auth-box h1 {
    font-size: 28px;
    color: #000;
    margin-bottom: 8px;
    text-align: center;
}

.auth-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

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

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

.auth-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #000;
}

.auth-form input {
    width: 100%;
    padding: 12px;
    border: 2px solid #000;
    background: white;
    font-size: 16px;
}

.auth-form input:focus {
    outline: none;
    border-color: #dc2626;
}

.auth-form small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

.auth-btn {
    width: 100%;
    background: #dc2626;
    color: white;
    border: 2px solid #000;
    padding: 15px 12px;
    min-height: 50px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.auth-btn:hover, .auth-btn:focus {
    background: #000;
    color: white;
    outline: 2px solid #dc2626;
    outline-offset: 2px;
}

.auth-btn:active {
    background: #333;
}

.auth-link {
    text-align: center;
    color: #666;
}

.auth-link a {
    color: #dc2626;
    text-decoration: none;
    font-weight: bold;
}

.auth-link a:hover {
    color: #000;
}

/* Demo Notice */
.demo-notice {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border: 2px solid #000;
    text-align: center;
}

.demo-notice h4 {
    font-size: 18px;
    color: #000;
    margin-bottom: 12px;
    font-weight: bold;
}

.demo-notice p {
    font-size: 14px;
    color: #666;
    margin-bottom: 16px;
    line-height: 1.4;
}

.demo-notice .github-link {
    background: #000;
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border: 2px solid #dc2626;
    font-weight: bold;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.demo-notice .github-link:hover {
    background: #dc2626;
    color: white;
}

.security-info {
    font-size: 12px !important;
    color: #dc2626 !important;
    font-weight: bold !important;
    margin-bottom: 0 !important;
}

/* Responsive design */

/* Large Desktop (1200px+) */
@media (min-width: 1200px) {
    .schedule-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 25px;
    }
    
    .day-column {
        min-height: 450px;
    }
    
    .container {
        max-width: 1600px;
    }
}

/* Desktop/Laptop (992px - 1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
    .schedule-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 20px;
    }
    
    .day-column {
        min-height: 400px;
    }
}

/* Tablet Landscape (768px - 991px) */
@media (max-width: 991px) and (min-width: 768px) {
    .schedule-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
    }
    
    .day-column {
        min-height: 350px;
    }
    
    .header-content {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .user-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .navigation {
        padding: 15px;
    }
    
    .nav-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .current-period {
        font-size: 16px;
    }
}

/* Tablet Portrait (576px - 767px) */
@media (max-width: 767px) and (min-width: 576px) {
    .container {
        margin: 0;
    }
    
    .schedule-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .banner-content {
        flex-direction: column;
        gap: 10px;
    }
    
    .open-source-text, .demo-text {
        font-size: 12px;
    }
    
    .github-badge {
        font-size: 11px;
        padding: 3px 8px;
    }
    
    .demo-notice {
        padding: 15px;
        margin-top: 20px;
    }
    
    .demo-notice h4 {
        font-size: 16px;
    }
    
    .demo-notice p {
        font-size: 13px;
    }
    
    .demo-notice .github-link {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .day-column {
        min-height: 320px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .navigation {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 15px;
    }
    
    .nav-btn {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
        padding: 12px;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .day-header h3 {
        font-size: 14px;
    }
    
    .day-header p {
        font-size: 12px;
    }
    
    .event-time {
        font-size: 11px;
    }
    
    .event-title {
        font-size: 13px;
    }
    
    .add-event-form {
        padding: 10px;
    }
    
    .form-group input {
        padding: 6px;
        font-size: 13px;
    }
    
    .time-inputs input {
        padding: 5px;
        font-size: 11px;
    }
    
    .add-btn {
        padding: 6px;
        font-size: 13px;
    }
}

/* Mobile Large (481px - 575px) */
@media (max-width: 575px) and (min-width: 481px) {
    .container {
        margin: 0;
        min-height: 100vh;
    }
    
    .schedule-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .day-column {
        min-height: 280px;
    }
    
    .header {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .user-info {
        flex-direction: column;
        gap: 8px;
        font-size: 14px;
    }
    
    .logout-btn {
        padding: 6px 12px;
        font-size: 14px;
    }
    
    .navigation {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        padding: 12px;
    }
    
    .nav-btn {
        width: 100%;
        padding: 10px;
        font-size: 14px;
    }
    
    .current-period {
        font-size: 14px;
        line-height: 1.4;
    }
    
    .main-content {
        padding: 10px;
    }
    
    .day-header {
        padding: 8px;
    }
    
    .day-header h3 {
        font-size: 13px;
    }
    
    .day-header p {
        font-size: 11px;
    }
    
    .events-list {
        padding: 8px;
        min-height: 150px;
    }
    
    .event {
        padding: 6px;
        margin-bottom: 6px;
    }
    
    .event-time {
        font-size: 10px;
    }
    
    .event-title {
        font-size: 12px;
    }
    
    .delete-btn {
        width: 18px;
        height: 18px;
        font-size: 12px;
    }
    
    .add-event-form {
        padding: 8px;
    }
    
    .form-group input {
        padding: 5px;
        font-size: 12px;
    }
    
    .time-inputs {
        gap: 4px;
    }
    
    .time-inputs input {
        padding: 4px;
        font-size: 10px;
    }
    
    .time-inputs span {
        font-size: 10px;
    }
    
    .add-btn {
        padding: 5px;
        font-size: 12px;
    }
}

/* Mobile Small (320px - 480px) */
@media (max-width: 480px) {
    .container {
        margin: 0;
        min-height: 100vh;
    }
    
    .schedule-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .day-column {
        min-height: 250px;
    }
    
    .header {
        padding: 12px;
    }
    
    .header h1 {
        font-size: 18px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .user-info {
        flex-direction: column;
        gap: 6px;
        font-size: 13px;
    }
    
    .logout-btn {
        padding: 5px 10px;
        font-size: 13px;
    }
    
    .navigation {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 10px;
    }
    
    .nav-btn {
        width: 100%;
        padding: 8px;
        font-size: 13px;
    }
    
    .current-period {
        font-size: 13px;
        line-height: 1.3;
        word-break: break-word;
    }
    
    .main-content {
        padding: 8px;
    }
    
    .day-header {
        padding: 6px;
    }
    
    .day-header h3 {
        font-size: 12px;
    }
    
    .day-header p {
        font-size: 10px;
    }
    
    .events-list {
        padding: 6px;
        min-height: 120px;
    }
    
    .event {
        padding: 4px;
        margin-bottom: 4px;
    }
    
    .event-time {
        font-size: 9px;
    }
    
    .event-title {
        font-size: 11px;
        line-height: 1.2;
    }
    
    .delete-btn {
        width: 16px;
        height: 16px;
        font-size: 11px;
    }
    
    .add-event-form {
        padding: 6px;
    }
    
    .form-group {
        margin-bottom: 6px;
    }
    
    .form-group input {
        padding: 4px;
        font-size: 11px;
    }
    
    .time-inputs {
        gap: 2px;
        margin-bottom: 6px;
    }
    
    .time-inputs input {
        padding: 3px;
        font-size: 9px;
    }
    
    .time-inputs span {
        font-size: 9px;
    }
    
    .add-btn {
        padding: 4px;
        font-size: 11px;
    }
    
    /* Authentication pages mobile */
    .auth-container {
        padding: 10px;
    }
    
    .auth-box {
        padding: 15px;
        border-width: 2px;
    }
    
    .auth-box h1 {
        font-size: 22px;
    }
    
    .auth-form input {
        padding: 8px;
        font-size: 14px;
    }
    
    .auth-btn {
        padding: 8px;
        font-size: 14px;
    }
    
    .banner-content {
        flex-direction: column;
        gap: 8px;
    }
    
    .open-source-text, .demo-text {
        font-size: 10px;
    }
    
    .github-badge {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .demo-notice {
        padding: 12px;
        margin-top: 15px;
    }
    
    .demo-notice h4 {
        font-size: 14px;
    }
    
    .demo-notice p {
        font-size: 11px;
    }
    
    .demo-notice .github-link {
        padding: 5px 8px;
        font-size: 11px;
    }
}

/* Ultra Small Mobile (below 320px) */
@media (max-width: 319px) {
    .schedule-grid {
        grid-template-columns: 1fr;
        gap: 5px;
    }
    
    .day-column {
        min-height: 200px;
    }
    
    .header h1 {
        font-size: 16px;
    }
    
    .current-period {
        font-size: 11px;
    }
    
    .day-header h3 {
        font-size: 11px;
    }
    
    .day-header p {
        font-size: 9px;
    }
    
    .auth-box {
        padding: 10px;
    }
    
    .auth-box h1 {
        font-size: 20px;
    }
}

/* Orientation-specific adjustments */
@media (orientation: landscape) and (max-height: 500px) {
    .day-column {
        min-height: 200px;
    }
    
    .events-list {
        min-height: 80px;
    }
    
    .navigation {
        padding: 8px;
    }
    
    .header {
        padding: 8px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .event {
        border-width: 1px;
    }
    
    .day-column {
        border-width: 1px;
    }
    
    .nav-btn, .logout-btn, .auth-btn {
        border-width: 1px;
    }
}
