/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

/* Header Styles */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3rem 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="40" fill="rgba(255,255,255,0.03)"/></svg>') repeat;
    opacity: 0.5;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    position: relative;
    font-weight: 700;
    letter-spacing: -0.5px;
}

header .subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    position: relative;
    font-weight: 300;
}

/* Main Content */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

/* Form Container */
.form-container {
    background: white;
    border-radius: 16px;
    padding: 3rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    transition: transform 0.3s ease;
}

/* Progress Bar */
.progress-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3rem;
    position: relative;
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: #e0e0e0;
    z-index: -1;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    text-align: center;
}

.step-number {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-bottom: 0.5rem;
    transition: all 0.4s ease;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.progress-step.active .step-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transform: scale(1.1);
}

.progress-step.completed .step-number {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.step-label {
    font-size: 0.9rem;
    color: #666;
}

.progress-step.active .step-label {
    color: #667eea;
    font-weight: 600;
}

/* Form Steps */
.form-step {
    display: none;
    animation: fadeIn 0.4s ease;
}

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

.form-step.active {
    display: block;
}

.form-step h2 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.instruction {
    color: #666;
    margin-bottom: 2rem;
    font-size: 1.05rem;
    line-height: 1.6;
}

/* Form Groups */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #fafafa;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Attributes Grid */
.attributes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Attribute Selector Tabs */
.attribute-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.attr-tab {
    padding: 0.75rem 1.5rem;
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.attr-tab:hover {
    background: #e8e8e8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.attr-tab.active {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border-color: #f093fb;
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3);
    transform: translateY(-2px);
}

/* Actions Container */
.actions-container {
    margin-bottom: 2rem;
}

.actions-form {
    display: none;
}

.actions-form h3 {
    color: #667eea;
    margin-bottom: 1.5rem;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.btn {
    padding: 0.875rem 2.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
}

/* Preview Section */
.preview-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid #e0e0e0;
}

.preview-section h3 {
    margin-bottom: 1.5rem;
    color: #333;
}

.harada-grid-preview {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1rem;
    min-height: 200px;
}

/* Print Controls */
.print-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 3rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
}

/* Harada Chart Styles */
.harada-chart {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 2rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
}

.chart-title {
    text-align: center;
    margin-bottom: 2rem;
}

.chart-title h2 {
    color: #333;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.chart-title .subtitle {
    font-size: 1.2rem;
    color: #666;
    font-weight: 400;
    margin-top: 0.5rem;
}

/* Chart Legend */
.chart-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 12px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
}

.legend-color {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.goal-color {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.attribute-color {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.action-color {
    background: #fafafa;
    border: 2px solid #e0e0e0;
}

.harada-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    gap: 2px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 3px solid #667eea;
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.2);
}

.grid-cell {
    background: white;
    padding: 0.5rem;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.7rem;
    overflow: hidden;
    word-wrap: break-word;
    border: 1px solid #ddd;
}

.grid-cell.main-goal {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1rem;
    font-weight: bold;
    padding: 0.75rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    border: 2px solid #667eea !important;
}

.grid-cell.attribute-cell {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    font-weight: bold;
    font-size: 0.75rem;
    box-shadow: 0 2px 10px rgba(240, 147, 251, 0.3);
    border: 1px solid #f093fb !important;
}

.grid-cell.action-cell {
    background: #fafafa;
    font-size: 0.65rem;
    line-height: 1.2;
    padding: 0.3rem;
    border: 1px solid #e0e0e0 !important;
    transition: background 0.2s ease;
}

.grid-cell.action-cell:hover {
    background: #f5f5f5;
}

/* Footer */
footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
    margin-top: 4rem;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}

footer p {
    font-weight: 300;
    opacity: 0.95;
}

/* Responsive Design */
@media (max-width: 768px) {
    .attributes-grid {
        grid-template-columns: 1fr;
    }

    .actions-grid {
        grid-template-columns: 1fr;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .harada-grid {
        font-size: 0.5rem;
        overflow-x: auto;
    }

    .grid-cell {
        min-height: 60px;
        padding: 0.2rem;
        font-size: 0.5rem;
    }

    .grid-cell.main-goal {
        font-size: 0.7rem;
    }

    .grid-cell.attribute-cell {
        font-size: 0.55rem;
    }

    .grid-cell.action-cell {
        font-size: 0.45rem;
    }
}

/* Print Styles */
@media print {
    @page {
        size: legal;
        margin: 0.4in;
    }

    body {
        background: white;
    }

    .no-print {
        display: none !important;
    }

    .harada-chart {
        max-width: 100%;
        margin: 0;
        padding: 0;
        page-break-inside: avoid;
        box-shadow: none;
        border-radius: 0;
        background: transparent;
    }

    .chart-title h2 {
        font-size: 1.5rem;
        margin-bottom: 0.3rem;
        color: #000 !important;
        -webkit-text-fill-color: #000 !important;
    }

    .chart-title .subtitle {
        font-size: 0.9rem;
        color: #666 !important;
        margin-top: 0.3rem;
    }

    .harada-grid {
        gap: 0;
        border: 2px solid #000;
        border-radius: 0;
        width: 100%;
        max-width: 100%;
        height: auto;
        box-shadow: none;
    }

    .grid-cell {
        border: 0.5px solid #000;
        min-height: 0.8in;
        max-height: 1.2in;
        padding: 0.15rem;
        font-size: 0.5rem;
        line-height: 1.1;
        page-break-inside: avoid;
    }

    .grid-cell.main-goal {
        background: #667eea !important;
        color: #ffffff !important;
        font-size: 0.75rem;
        font-weight: bold;
        border: 2px solid #667eea !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .grid-cell.attribute-cell {
        background: #f093fb !important;
        color: #ffffff !important;
        font-size: 0.55rem;
        font-weight: bold;
        border: 1.5px solid #f093fb !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .grid-cell.action-cell {
        background: #ffffff !important;
        font-size: 0.45rem;
        line-height: 1.15;
        padding: 0.1rem;
        border: 0.5px solid #cccccc !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
