/**
 * Global Styles for Family Wishlist Application
 * 
 * Provides base styles and responsive design for all pages
 * Requirements: 8.1, 8.2, 8.3, 8.4, 8.5
 */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.2;
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.75rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1rem;
}

a {
    color: #4CAF50;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: background 0.3s;
}

.btn:hover {
    background: #45a049;
    text-decoration: none;
}

.btn-secondary {
    background: #757575;
}

.btn-secondary:hover {
    background: #616161;
}

.btn-danger {
    background: #f44336;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* Forms */
.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-control:focus {
    outline: none;
    border-color: #4CAF50;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
}

/* Navigation */
.navbar {
    background: #4CAF50;
    color: white;
    padding: 15px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
}

.navbar-brand:hover {
    text-decoration: none;
}

.navbar-nav {
    display: flex;
    list-style: none;
    gap: 20px;
}

.navbar-nav a {
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background 0.3s;
}

.navbar-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background: #f5f5f5;
    font-weight: 600;
}

/* Alerts */
.alert {
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #4CAF50;
}

.alert-error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #f44336;
}

.alert-info {
    background: #e3f2fd;
    color: #1565c0;
    border-left: 4px solid #2196F3;
}

/* Responsive Design - Tablet */
@media (max-width: 1024px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
}

/* Responsive Design - Mobile */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    .container {
        padding: 10px;
    }
    
    .navbar .container {
        flex-direction: column;
        gap: 10px;
    }
    
    .navbar-nav {
        flex-direction: column;
        gap: 5px;
        width: 100%;
    }
    
    .navbar-nav a {
        display: block;
        text-align: center;
    }
    
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 8px;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* Touch-friendly controls for mobile and tablet */
@media (max-width: 1024px) {
    .btn, .form-control, a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.hidden {
    display: none;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
    max-width: 400px;
}

.notification-success {
    background-color: #4CAF50;
    color: white;
}

.notification-error {
    background-color: #f44336;
    color: white;
}

.notification-fade-out {
    animation: fadeOut 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Edit Form Styles (for inline editing) */
.edit-form {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 4px;
    margin-top: 10px;
}

.edit-form .form-group {
    margin-bottom: 15px;
}

.edit-form .form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.edit-form .form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.edit-form .form-control:focus {
    outline: none;
    border-color: #4CAF50;
}

.edit-form textarea.form-control {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}

.edit-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Responsive adjustments for notifications */
@media (max-width: 768px) {
    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .edit-form .form-row {
        grid-template-columns: 1fr;
    }
}
